@skeel/launcher
    Preparing search index...

    Interface EventBroker

    Event broker interface for subscribing to Skeel lifecycle events.

    This broker enables safe event subscription before the Skeel instance is initialized, which is particularly useful when the Skeel script is loaded asynchronously. Without the broker, you would need to check if window.Skeel exists before subscribing, potentially missing initialization events.

    interface EventBroker {
        onInit?(instance: ISkeel): void;
        subscribe(event: "init", handler: InitHandler): Unsubscriber;
    }
    Index
    • Subscribe to the init event which fires when the Skeel instance is initialized.

      The handler is called regardless of when you subscribe:

      • If subscribed before initialization, the handler will be called when initialization occurs.
      • If subscribed after initialization, the handler will be called immediately (asynchronously).

      This ensures your handler is always invoked with the Skeel instance, eliminating timing concerns. To prevent memory leaks, it's recommended to access the Skeel instance via window.Skeel rather than storing the instance passed to the handler somewhere locally.

      Parameters

      • event: "init"

        The event name.

      • handler: InitHandler

        The handler function to be called when the event fires.

      Returns Unsubscriber

      A function to unsubscribe from the event.