toolish - v0.2.5
    Preparing search index...

    Class EventSource<T>

    Supports handling events of a single type. A typical use case is managing your own EventSource instances and registering handlers and submitting events directly trough them.

    const assetLoaded = new EventSource<AssetEvent>();
    assetLoaded.handle(e => use(e.asset));
    assetLoaded.submit(new AssetEvent(asset));

    Type Parameters

    Index

    Constructors

    Methods

    • Call the current handlers according to the priority they were registered with.

      It's important to realise that even though handlers are free to perform asynchronous actions, they're processed sequentially. If a handler returns a promise, further processing waits until it settles.

      Handlers can stop further processing.

      Parameters

      • event: T

      Returns Promise<void>

      a promise that settles when processing is done