mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 12:43:26 +00:00
improve typings: EventEmitter
This commit is contained in:
parent
094e322ace
commit
265bfc76fb
2 changed files with 17 additions and 17 deletions
|
@ -58,7 +58,7 @@ var EventEmitter = new Class({
|
|||
* @method Phaser.Events.EventEmitter#eventNames
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {array}
|
||||
* @return {Array.<string|symbol>}
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ var EventEmitter = new Class({
|
|||
*
|
||||
* @param {(string|symbol)} event - The event name.
|
||||
*
|
||||
* @return {array} The registered listeners.
|
||||
* @return {Function[]} The registered listeners.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -105,7 +105,7 @@ var EventEmitter = new Class({
|
|||
* @param {function} fn - The listener function.
|
||||
* @param {*} [context=this] - The context to invoke the listener with.
|
||||
*
|
||||
* @return {Phaser.Events.EventEmitter} `this`.
|
||||
* @return {this} `this`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -118,7 +118,7 @@ var EventEmitter = new Class({
|
|||
* @param {function} fn - The listener function.
|
||||
* @param {*} [context=this] - The context to invoke the listener with.
|
||||
*
|
||||
* @return {Phaser.Events.EventEmitter} `this`.
|
||||
* @return {this} `this`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -131,7 +131,7 @@ var EventEmitter = new Class({
|
|||
* @param {function} fn - The listener function.
|
||||
* @param {*} [context=this] - The context to invoke the listener with.
|
||||
*
|
||||
* @return {Phaser.Events.EventEmitter} `this`.
|
||||
* @return {this} `this`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -145,7 +145,7 @@ var EventEmitter = new Class({
|
|||
* @param {*} [context] - Only remove the listeners that have this context.
|
||||
* @param {boolean} [once] - Only remove one-time listeners.
|
||||
*
|
||||
* @return {Phaser.Events.EventEmitter} `this`.
|
||||
* @return {this} `this`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -159,7 +159,7 @@ var EventEmitter = new Class({
|
|||
* @param {*} [context] - Only remove the listeners that have this context.
|
||||
* @param {boolean} [once] - Only remove one-time listeners.
|
||||
*
|
||||
* @return {Phaser.Events.EventEmitter} `this`.
|
||||
* @return {this} `this`.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -170,7 +170,7 @@ var EventEmitter = new Class({
|
|||
*
|
||||
* @param {(string|symbol)} [event] - The event name.
|
||||
*
|
||||
* @return {Phaser.Events.EventEmitter} `this`.
|
||||
* @return {this} `this`.
|
||||
*/
|
||||
|
||||
PluginCache.register('EventEmitter', EventEmitter, 'events');
|
||||
|
|
18
types/phaser.d.ts
vendored
18
types/phaser.d.ts
vendored
|
@ -7876,13 +7876,13 @@ declare namespace Phaser {
|
|||
/**
|
||||
* Return an array listing the events for which the emitter has registered listeners.
|
||||
*/
|
||||
eventNames(): any[];
|
||||
eventNames(): (string|symbol)[];
|
||||
|
||||
/**
|
||||
* Return the listeners registered for a given event.
|
||||
* @param event The event name.
|
||||
*/
|
||||
listeners(event: string | symbol): any[];
|
||||
listeners(event: string | symbol): Function[];
|
||||
|
||||
/**
|
||||
* Return the number of listeners listening to a given event.
|
||||
|
@ -7903,7 +7903,7 @@ declare namespace Phaser {
|
|||
* @param fn The listener function.
|
||||
* @param context The context to invoke the listener with. Default this.
|
||||
*/
|
||||
on(event: string | symbol, fn: Function, context?: any): Phaser.Events.EventEmitter;
|
||||
on(event: string | symbol, fn: Function, context?: any): this;
|
||||
|
||||
/**
|
||||
* Add a listener for a given event.
|
||||
|
@ -7911,7 +7911,7 @@ declare namespace Phaser {
|
|||
* @param fn The listener function.
|
||||
* @param context The context to invoke the listener with. Default this.
|
||||
*/
|
||||
addListener(event: string | symbol, fn: Function, context?: any): Phaser.Events.EventEmitter;
|
||||
addListener(event: string | symbol, fn: Function, context?: any): this;
|
||||
|
||||
/**
|
||||
* Add a one-time listener for a given event.
|
||||
|
@ -7919,7 +7919,7 @@ declare namespace Phaser {
|
|||
* @param fn The listener function.
|
||||
* @param context The context to invoke the listener with. Default this.
|
||||
*/
|
||||
once(event: string | symbol, fn: Function, context?: any): Phaser.Events.EventEmitter;
|
||||
once(event: string | symbol, fn: Function, context?: any): this;
|
||||
|
||||
/**
|
||||
* Remove the listeners of a given event.
|
||||
|
@ -7928,7 +7928,7 @@ declare namespace Phaser {
|
|||
* @param context Only remove the listeners that have this context.
|
||||
* @param once Only remove one-time listeners.
|
||||
*/
|
||||
removeListener(event: string | symbol, fn?: Function, context?: any, once?: boolean): Phaser.Events.EventEmitter;
|
||||
removeListener(event: string | symbol, fn?: Function, context?: any, once?: boolean): this;
|
||||
|
||||
/**
|
||||
* Remove the listeners of a given event.
|
||||
|
@ -7937,13 +7937,13 @@ declare namespace Phaser {
|
|||
* @param context Only remove the listeners that have this context.
|
||||
* @param once Only remove one-time listeners.
|
||||
*/
|
||||
off(event: string | symbol, fn?: Function, context?: any, once?: boolean): Phaser.Events.EventEmitter;
|
||||
off(event: string | symbol, fn?: Function, context?: any, once?: boolean): this;
|
||||
|
||||
/**
|
||||
* Remove all listeners, or those of the specified event.
|
||||
* @param event The event name.
|
||||
*/
|
||||
removeAllListeners(event?: string | symbol): Phaser.Events.EventEmitter;
|
||||
removeAllListeners(event?: string | symbol): this;
|
||||
|
||||
}
|
||||
|
||||
|
@ -50758,7 +50758,7 @@ declare namespace Phaser {
|
|||
/**
|
||||
* If provided as an array, the range defined by `start` and `end` will be ignored and these frame numbers will be used.
|
||||
*/
|
||||
frames?: boolean;
|
||||
frames?: boolean | integer[];
|
||||
};
|
||||
|
||||
type GenerateFrameNumbers = {
|
||||
|
|
Loading…
Reference in a new issue