Fix chrome.events.Event definition

Made all methods to strictly accept same type of function; fixes removeListener incompatibility.
This commit is contained in:
Ingvar Stepanyan
2016-02-13 22:00:25 +00:00
parent bcd5761826
commit 39baf904d4

8
chrome/chrome.d.ts vendored
View File

@@ -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.
@@ -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.
@@ -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;
}