formcycle 8.3.6 - JavaScript for forms
    Preparing search index...

    Interface EventSource<Context, Data>

    Interfaces for event source objects. Interested parties can subscribe to the event and are notified when the event occurs.

    interface EventSource<Context, Data> {
        off: (listener: EventListener<Data>, context?: Context) => void;
        on: (listener: EventListener<Data>, context?: Context) => void;
        one: (listener: EventListener<Data>, context?: Context) => void;
        removeAll: () => void;
        removeAllByContext: (context: Context) => void;
        removeAllByListener: (listener: EventListener<Data>) => void;
    }

    Type Parameters

    • Context
    • Data
    Index

    Properties

    off: (listener: EventListener<Data>, context?: Context) => void

    Removes the given listener that was previously added via on or one. Note that the context must be the same as the context that was passed to on or one.

    Type declaration

    on: (listener: EventListener<Data>, context?: Context) => void

    Register the given listener with the event source. When the event occurs, the given listener is invoked. You can specify an optional context parameter to restrict the scope of the listener.

    Uncaught errors in the listener are caught and logged, but not propagated. Note that registering the same listener with the same context twice has no effect.

    Type declaration

    one: (listener: EventListener<Data>, context?: Context) => void

    Register the given listener with the event source. When the event occurs the next time, the given listener is invoked once, then removed. You can specify an optional context parameter to restrict the scope of the listener.

    Uncaught errors in the listener are caught and logged, but not propagated. Note that registering the same listener with the same context twice has no effect.

    Type declaration

    removeAll: () => void

    Removes all event subscriptions for this event source.

    removeAllByContext: (context: Context) => void

    Removes all event subscriptions with the given context, irrespective of the listener.

    Type declaration

      • (context: Context): void
      • Parameters

        • context: Context

          Context of the subscriptions to remove.

        Returns void

    removeAllByListener: (listener: EventListener<Data>) => void

    Removes all event subscriptions with the given listener, irrespective of the context.

    Type declaration