Skip to content

Commit

Permalink
Fix chrome.events.Event definition
Browse files Browse the repository at this point in the history
Made all methods to strictly accept same type of function; fixes removeListener incompatibility.
  • Loading branch information
RReverser committed Feb 13, 2016
1 parent bcd5761 commit 39baf90
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions chrome/chrome.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2537,14 +2537,14 @@ declare module chrome.events {
}

/** An object which allows the addition and removal of listeners for a Chrome event. */
interface Event {
interface Event<T extends Function> {
/**
* Registers an event listener callback to an event.
* @param callback Called when an event occurs. The parameters of this function depend on the type of event.
* The callback parameter should be a function that looks like this:
* function() {...};
*/
addListener(callback: Function): void;
addListener(callback: T): void;
/**
* Returns currently registered rules.
* @param callback Called with registered rules.
Expand All @@ -2565,7 +2565,7 @@ declare module chrome.events {
/**
* @param callback Listener whose registration status shall be tested.
*/
hasListener(callback: Function): boolean;
hasListener(callback: T): boolean;
/**
* Unregisters currently registered rules.
* @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are unregistered.
Expand Down Expand Up @@ -2596,7 +2596,7 @@ declare module chrome.events {
* The callback parameter should be a function that looks like this:
* function() {...};
*/
removeListener(callback: () => void): void;
removeListener(callback: T): void;
hasListeners(): boolean;
}

Expand Down

0 comments on commit 39baf90

Please sign in to comment.