Function eventField

  • Fired when eventName fires on target.

    Rather than whole event args being emitted on the stream, it plucks a field from the event args, or if that's missing, from the target.

    // Emits the the value of a field named 'x'
    // on the change event args
    eventField(el, `pointermove`, `x`);

    Type Parameters

    • TFieldValue = string

    Parameters

    • targetOrQuery: null | string | EventTarget

      Event target, HTML element or HTML query (eg '#someId')

    • eventName: string

      Name of event, eg. 'pointermove'

    • fieldName: string

      Name of field, eg 'x'

    • initialValue: TFieldValue

      Initial data

    • options: Partial<EventOptions & InitStreamOptions & {
          fallbackFieldValue: TFieldValue;
          fallbackObject: any;
      }> = {}

      Options for source

    Returns Reactive<TFieldValue>