Skip to content

Commit 265bfc7

Browse files
committed
improve typings: EventEmitter
1 parent 094e322 commit 265bfc7

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/events/EventEmitter.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var EventEmitter = new Class({
5858
* @method Phaser.Events.EventEmitter#eventNames
5959
* @since 3.0.0
6060
*
61-
* @return {array}
61+
* @return {Array.<string|symbol>}
6262
*/
6363

6464
/**
@@ -69,7 +69,7 @@ var EventEmitter = new Class({
6969
*
7070
* @param {(string|symbol)} event - The event name.
7171
*
72-
* @return {array} The registered listeners.
72+
* @return {Function[]} The registered listeners.
7373
*/
7474

7575
/**
@@ -105,7 +105,7 @@ var EventEmitter = new Class({
105105
* @param {function} fn - The listener function.
106106
* @param {*} [context=this] - The context to invoke the listener with.
107107
*
108-
* @return {Phaser.Events.EventEmitter} `this`.
108+
* @return {this} `this`.
109109
*/
110110

111111
/**
@@ -118,7 +118,7 @@ var EventEmitter = new Class({
118118
* @param {function} fn - The listener function.
119119
* @param {*} [context=this] - The context to invoke the listener with.
120120
*
121-
* @return {Phaser.Events.EventEmitter} `this`.
121+
* @return {this} `this`.
122122
*/
123123

124124
/**
@@ -131,7 +131,7 @@ var EventEmitter = new Class({
131131
* @param {function} fn - The listener function.
132132
* @param {*} [context=this] - The context to invoke the listener with.
133133
*
134-
* @return {Phaser.Events.EventEmitter} `this`.
134+
* @return {this} `this`.
135135
*/
136136

137137
/**
@@ -145,7 +145,7 @@ var EventEmitter = new Class({
145145
* @param {*} [context] - Only remove the listeners that have this context.
146146
* @param {boolean} [once] - Only remove one-time listeners.
147147
*
148-
* @return {Phaser.Events.EventEmitter} `this`.
148+
* @return {this} `this`.
149149
*/
150150

151151
/**
@@ -159,7 +159,7 @@ var EventEmitter = new Class({
159159
* @param {*} [context] - Only remove the listeners that have this context.
160160
* @param {boolean} [once] - Only remove one-time listeners.
161161
*
162-
* @return {Phaser.Events.EventEmitter} `this`.
162+
* @return {this} `this`.
163163
*/
164164

165165
/**
@@ -170,7 +170,7 @@ var EventEmitter = new Class({
170170
*
171171
* @param {(string|symbol)} [event] - The event name.
172172
*
173-
* @return {Phaser.Events.EventEmitter} `this`.
173+
* @return {this} `this`.
174174
*/
175175

176176
PluginCache.register('EventEmitter', EventEmitter, 'events');

types/phaser.d.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7876,13 +7876,13 @@ declare namespace Phaser {
78767876
/**
78777877
* Return an array listing the events for which the emitter has registered listeners.
78787878
*/
7879-
eventNames(): any[];
7879+
eventNames(): (string|symbol)[];
78807880

78817881
/**
78827882
* Return the listeners registered for a given event.
78837883
* @param event The event name.
78847884
*/
7885-
listeners(event: string | symbol): any[];
7885+
listeners(event: string | symbol): Function[];
78867886

78877887
/**
78887888
* Return the number of listeners listening to a given event.
@@ -7903,23 +7903,23 @@ declare namespace Phaser {
79037903
* @param fn The listener function.
79047904
* @param context The context to invoke the listener with. Default this.
79057905
*/
7906-
on(event: string | symbol, fn: Function, context?: any): Phaser.Events.EventEmitter;
7906+
on(event: string | symbol, fn: Function, context?: any): this;
79077907

79087908
/**
79097909
* Add a listener for a given event.
79107910
* @param event The event name.
79117911
* @param fn The listener function.
79127912
* @param context The context to invoke the listener with. Default this.
79137913
*/
7914-
addListener(event: string | symbol, fn: Function, context?: any): Phaser.Events.EventEmitter;
7914+
addListener(event: string | symbol, fn: Function, context?: any): this;
79157915

79167916
/**
79177917
* Add a one-time listener for a given event.
79187918
* @param event The event name.
79197919
* @param fn The listener function.
79207920
* @param context The context to invoke the listener with. Default this.
79217921
*/
7922-
once(event: string | symbol, fn: Function, context?: any): Phaser.Events.EventEmitter;
7922+
once(event: string | symbol, fn: Function, context?: any): this;
79237923

79247924
/**
79257925
* Remove the listeners of a given event.
@@ -7928,7 +7928,7 @@ declare namespace Phaser {
79287928
* @param context Only remove the listeners that have this context.
79297929
* @param once Only remove one-time listeners.
79307930
*/
7931-
removeListener(event: string | symbol, fn?: Function, context?: any, once?: boolean): Phaser.Events.EventEmitter;
7931+
removeListener(event: string | symbol, fn?: Function, context?: any, once?: boolean): this;
79327932

79337933
/**
79347934
* Remove the listeners of a given event.
@@ -7937,13 +7937,13 @@ declare namespace Phaser {
79377937
* @param context Only remove the listeners that have this context.
79387938
* @param once Only remove one-time listeners.
79397939
*/
7940-
off(event: string | symbol, fn?: Function, context?: any, once?: boolean): Phaser.Events.EventEmitter;
7940+
off(event: string | symbol, fn?: Function, context?: any, once?: boolean): this;
79417941

79427942
/**
79437943
* Remove all listeners, or those of the specified event.
79447944
* @param event The event name.
79457945
*/
7946-
removeAllListeners(event?: string | symbol): Phaser.Events.EventEmitter;
7946+
removeAllListeners(event?: string | symbol): this;
79477947

79487948
}
79497949

@@ -50758,7 +50758,7 @@ declare namespace Phaser {
5075850758
/**
5075950759
* If provided as an array, the range defined by `start` and `end` will be ignored and these frame numbers will be used.
5076050760
*/
50761-
frames?: boolean;
50761+
frames?: boolean | integer[];
5076250762
};
5076350763

5076450764
type GenerateFrameNumbers = {

0 commit comments

Comments
 (0)