An object which allows the addition and removal of listeners for a Chrome event.

interface Event {
    addListener(callback: () => void): void;
    addRules?(
        eventName: string,
        webViewInstanceId: number,
        rules: browser.events.Rule[],
    ): Promise<browser.events.Rule[]>;
    getRules?(
        eventName: string,
        webViewInstanceId: number,
        ruleIdentifiers?: string[],
    ): Promise<browser.events.Rule[]>;
    hasListener(callback: () => void): boolean;
    hasListeners(): boolean;
    removeListener(callback: () => void): void;
    removeRules?(
        eventName: string,
        webViewInstanceId: number,
        ruleIdentifiers?: string[],
    ): Promise<void>;
}
Index
  • Registers an event listener callback to an event.

    Parameters

    • callback: () => void

      Called when an event occurs. The parameters of this function depend on the type of event.

    Returns void

  • Registers rules to handle events.

    Parameters

    • eventName: string

      Name of the event this function affects.

    • webViewInstanceId: number

      If provided, this is an integer that uniquely identfies the associated with this function call.

    • rules: browser.events.Rule[]

      Rules to be registered. These do not replace previously registered rules.

    Returns Promise<browser.events.Rule[]>

    Unsupported on Firefox at this time.

  • Returns currently registered rules.

    Parameters

    • eventName: string

      Name of the event this function affects.

    • webViewInstanceId: number

      If provided, this is an integer that uniquely identfies the associated with this function call.

    • OptionalruleIdentifiers: string[]

      If an array is passed, only rules with identifiers contained in this array are returned.

    Returns Promise<browser.events.Rule[]>

    Unsupported on Firefox at this time.

  • Parameters

    • callback: () => void

      Listener whose registration status shall be tested.

    Returns boolean

    True if callback is registered to the event.

  • Returns boolean

    True if any event listeners are registered to the event.

  • Deregisters an event listener callback from an event.

    Parameters

    • callback: () => void

      Listener that shall be unregistered.

    Returns void

  • Unregisters currently registered rules.

    Parameters

    • eventName: string

      Name of the event this function affects.

    • webViewInstanceId: number

      If provided, this is an integer that uniquely identfies the associated with this function call.

    • OptionalruleIdentifiers: string[]

      If an array is passed, only rules with identifiers contained in this array are unregistered.

    Returns Promise<void>

    Unsupported on Firefox at this time.