Interface Event<Payload>

A CloudpilotEmu event.

interface Event {
    addHandler<Context>(handler, context?): Event<Payload>;
    removeHandler<Context>(handler, context?): Event<Payload>;
}

Type Parameters

  • Payload

Methods

  • Bind an handler callback to the event.

    CAUTION: a handler that is bound multiple times will be called multiple times, too!

    Type Parameters

    • Context

    Parameters

    • handler: Handler<Payload, Context>

      Handler callback.

    • Optional context: Context

      Optional context that is passed to the callback.

    Returns Event<Payload>

  • Remove a previously bound handler. Both callback and context must be identical for the handler to be removed.

    CAUTION: this method will only remove one callback each call, even if a handler / callback combo is bound multiple times.

    Type Parameters

    • Context

    Parameters

    • handler: Handler<Payload, Context>

      Handler callback.

    • Optional context: Context

      Optional callback context.

    Returns Event<Payload>

Generated using TypeDoc