An interface allows to register listeners for objects that emit events. If you have a custom class that emits events, you may want to consider using Evented with EventedSupport.

interface Evented {
    on(
        event: string,
        callback: (...args: any[]) => void,
        context?: any,
    ): Handle;
}

Hierarchy (View Summary)

Implemented by

Methods

Methods

  • Registers a callback function for a given event type.

    Parameters

    • event: string

      the event type to register on

    • callback: (...args: any[]) => void

      the callback function to register

    • Optionalcontext: any

      the context in which the callback function should be invoked implementation dependent.

    Returns Handle

    a handle to the registered callback with a single function 'remove'. This function can be used to unregister the callback function.