Class AbstractInElement<TValue, TElt>

Abstract implementation of input HTML element control.

Type Parameters

  • TValue

    Input value type.

  • TElt extends HTMLElement

    A type of input HTML element.

Hierarchy

Constructors

  • Constructs HTML input element control.

    Type Parameters

    • TValue

    • TElt extends HTMLElement<TElt>

    Parameters

    • element: TElt

      HTML input element the constructed control is based on.

    • __namedParameters: {
          aspects?: Aspect<TValue, TValue> | readonly Aspect<TValue, TValue>[];
          get: ((this) => TValue);
          set: ((this, value) => void);
      }
      • Optional Readonly aspects?: Aspect<TValue, TValue> | readonly Aspect<TValue, TValue>[]
      • Readonly get: ((this) => TValue)
      • Readonly set: ((this, value) => void)
          • (this, value): void
          • Parameters

            Returns void

    Returns AbstractInElement<TValue, TElt>

Properties

element: TElt

HTML input element the constructed control is based on.

events: DomEventDispatcher

DOM event dispatcher of this element.

input: AfterEvent<[Input<TValue>]>

An AfterEvent keeper of user input.

on: OnEvent<[TValue, TValue]>

OnEvent sender of value changes.

The [OnEvent__symbol] property is an alias of this one.

Returns

Value changes sender.

read: AfterEvent<[TValue]>

AfterEvent keeper of current value.

The [AfterEvent__symbol] property is an alias of this one.

Returns

Current value keeper.

Accessors

  • get supply(): Supply
  • This control's input supply.

    Releases all control resources when cut off.

    Each control has its own supply. An input supply of converted control depends on the input supply of control it is converted from.

    After this supply cut off the control should no longer be used.

    Returns Supply

Methods

  • Returns AfterEvent<[TValue]>

  • Returns OnEvent<[TValue, TValue]>

  • Updates the tracked value by the given value supplier.

    If the value is already updated by another supplier, then unbinds from the old one first.

    Call the byNone method to unbind the tracked value from the source.

    Note that explicitly updating the value would override the value received from the source.

    Parameters

    • supplier: EventSupplier<[TValue]>

      The source value sender or keeper.

    Returns AbstractInElement<TValue, TElt>

    this instance.

  • Updates the tracked value by value suppliers extracted from events sent by the given supplier.

    If the value is already updated by another value supplier, then unbinds from the old one first.

    Call the byNone method to unbind the tracked value from the source.

    Note that explicitly updating the value would override the value received from the source.

    Type Parameters

    • TSrcEvent extends any[]

      Source event type.

    Parameters

    • supplier: EventSupplier<TSrcEvent>

      The event supplier to extract value suppliers from.

    • extract: ((this, ...event) => undefined | EventSupplier<[TValue]>)

      A function extracting value supplier from event received from supplier. May return undefined to suspend receiving values.

        • (this, ...event): undefined | EventSupplier<[TValue]>
        • Parameters

          • this: void
          • Rest ...event: TSrcEvent

          Returns undefined | EventSupplier<[TValue]>

    Returns AbstractInElement<TValue, TElt>

    this instance.

  • Unbinds the tracked value from any value supplier this tracker is updated by.

    If the tracker is not bound then does nothing.

    Parameters

    • Optional reason: unknown

      Arbitrary reason of unbinding the value.

    Returns AbstractInElement<TValue, TElt>

    this instance.

  • Enables reaction to input input.

    By default listens for input and change events.

    Parameters

    • update: ((input) => void)

      Updates current value by user input and sends update event. This function is to be called by input event listeners.

        • (input): void
        • Parameters

          Returns void

    Returns void

Generated using TypeDoc