@kayelaa/canvas API - v0.3.2
    Preparing search index...

    Class DeltaTimeout

    Generic event emitter with typed events and methods similar to Node.js EventEmitter.

    const emitter = new LeaEventEmitter<{
    update: [number];
    error: [Error];
    }>();

    emitter.on('update', (delta) => console.log(delta));
    emitter.emit('update', 0.016);

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    listenerMap: Map<"finish", Listener<any[]>[]> = ...
    duration: number
    elapsed: number
    finished: boolean
    easing: (t: number) => number

    Methods

    • Await the next emission of a specific event. Resolves with the arguments passed to that event.

      Type Parameters

      • K extends "finish"

      Parameters

      • event: K
      • timeout: number = ...

      Returns Promise<{ finish: void[] }[K]>

    • Await the next emission of any one of the listed events. Resolves with { event: name, args: the arguments it received }

      Type Parameters

      • K extends "finish"

      Parameters

      • events: K[]

      Returns Promise<{ event: K; args: { finish: void[] }[K] }>

    • Type Parameters

      • const K extends readonly "finish"[]

      Parameters

      • ...events: K

      Returns Promise<{ [I in string | number | symbol]: { finish: void[] }[K[I<I>]] }>

    • Registers a listener for the specified event.

      Type Parameters

      • K extends "finish"

        Event name

      Parameters

      • event: K

        The name of the event

      • listener: (...args: { finish: void[] }[K]) => void

        The callback to invoke when the event is emitted

      Returns this

      This emitter for chaining

    • Registers a listener for the specified event but returns a cleanup func.

      Type Parameters

      • K extends "finish"

        Event name

      Parameters

      • event: K

        The name of the event

      • listener: (off: () => void, ...args: { finish: void[] }[K]) => void

        The callback to invoke when the event is emitted

      Returns () => void

    • Registers a one-time listener for the specified event.

      The listener is automatically removed after the first invocation.

      Type Parameters

      • K extends "finish"

        Event name

      Parameters

      • event: K

        The name of the event

      • listener: (...args: { finish: void[] }[K]) => void

        The callback to invoke once

      Returns this

      This emitter for chaining

    • Removes a listener for the specified event.

      Type Parameters

      • K extends "finish"

        Event name

      Parameters

      • event: K

        The name of the event

      • listener: (...args: { finish: void[] }[K]) => void

        The callback to remove

      Returns this

      This emitter for chaining

    • Emits an event, invoking all registered listeners with the provided arguments.

      If the event is "error" and no listeners are registered, the first argument (the error) will be thrown.

      Type Parameters

      • K extends "finish"

        Event name

      Parameters

      • event: K

        The name of the event to emit

      • ...args: { finish: void[] }[K]

        Arguments to pass to listeners

      Returns boolean

      true if any listeners were invoked, false otherwise

    • Emits an event, invoking all registered listeners with the provided arguments.

      If the event is "error" and no listeners are registered, the first argument (the error) will be thrown.

      Type Parameters

      • K extends "finish"

        Event name

      Parameters

      • event: K

        The name of the event to emit

      • ...args: any

        Arguments to pass to listeners

      Returns boolean

      true if any listeners were invoked, false otherwise

    • Removes all listeners for the specified event, or all listeners if no event is provided.

      Type Parameters

      • K extends "finish"

        Event name

      Parameters

      • Optionalevent: K

        Optional event name to clear listeners for

      Returns DeltaTimeout

      This emitter for chaining

    • Returns the number of listeners registered for the specified event.

      Type Parameters

      • K extends "finish"

        Event name

      Parameters

      • event: K

        The event to count listeners for

      Returns number

      The number of registered listeners

    • Returns Promise<unknown>

    • Advance tween by delta time

      Parameters

      • deltaSeconds: number

      Returns void