@creejs/commons-events 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -4
- package/types/event-emitter.d.ts +4 -4
- package/types/event.d.ts +4 -4
- package/types/index.d.ts +1 -1
- package/types/listener.d.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creejs/commons-events",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Commons EventEmitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"commons",
|
|
@@ -46,16 +46,15 @@
|
|
|
46
46
|
"url": "git+https://github.com/frameworkee/commons.git"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"dts": "tsc",
|
|
49
|
+
"dts": "npx tsc",
|
|
50
50
|
"generate-docs": "../../node_modules/.bin/jsdoc -c ./jsdoc.json",
|
|
51
51
|
"clean": "rm -rf dist && rm -rf types",
|
|
52
52
|
"build": "npm run clean && npm run dts && rollup -c",
|
|
53
|
-
"prepublishOnly": "npm run build",
|
|
54
53
|
"publish": "npm publish"
|
|
55
54
|
},
|
|
56
55
|
"author": "rodney.vin@gmail.com",
|
|
57
56
|
"license": "Apache-2.0",
|
|
58
57
|
"dependencies": {
|
|
59
|
-
"@creejs/commons-lang": "^2.0
|
|
58
|
+
"@creejs/commons-lang": "^2.1.0"
|
|
60
59
|
}
|
|
61
60
|
}
|
package/types/event-emitter.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export default class EventEmitter {
|
|
|
13
13
|
* @returns {T} The modified object with EventEmitter methods.
|
|
14
14
|
*/
|
|
15
15
|
static mixin<T>(obj: T): T;
|
|
16
|
-
static set defaultMaxListeners(
|
|
16
|
+
static set defaultMaxListeners(maxListeners: number);
|
|
17
17
|
static get defaultMaxListeners(): number;
|
|
18
18
|
/**
|
|
19
19
|
* @type {Map<string|Symbol, Event>}
|
|
@@ -67,7 +67,7 @@ export default class EventEmitter {
|
|
|
67
67
|
* @param {function} [listener] - Optional specific listener to count
|
|
68
68
|
* @returns {number} The number of listeners for the event
|
|
69
69
|
*/
|
|
70
|
-
listenerCount(eventName: string | Symbol, listener?: Function
|
|
70
|
+
listenerCount(eventName: string | Symbol, listener?: Function): number;
|
|
71
71
|
/**
|
|
72
72
|
* Returns a copy of the array of listeners for the event named eventName.
|
|
73
73
|
* 1. if a callback function added multiple times, it will be returned multiple times.
|
|
@@ -174,5 +174,5 @@ export default class EventEmitter {
|
|
|
174
174
|
hasOwner(owner: Object): boolean;
|
|
175
175
|
}
|
|
176
176
|
export { EventEmitter as EventEmitterType };
|
|
177
|
-
import Event from
|
|
178
|
-
import Listener from
|
|
177
|
+
import Event from './event.js';
|
|
178
|
+
import Listener from './listener.js';
|
package/types/event.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export default class Event {
|
|
|
53
53
|
* @param {Function} [callback] - The callback function to count
|
|
54
54
|
* @returns {number}
|
|
55
55
|
*/
|
|
56
|
-
listenerCount(callback?: Function
|
|
56
|
+
listenerCount(callback?: Function): number;
|
|
57
57
|
/**
|
|
58
58
|
* Returns a shallow copy of the registered callbacks array.
|
|
59
59
|
* if one callback function is added multiple times, it will be returned multiple times.
|
|
@@ -101,7 +101,7 @@ export default class Event {
|
|
|
101
101
|
* @param {Object} [owner] - The object that owns the callback (used for binding `this` context).
|
|
102
102
|
* @returns {boolean}
|
|
103
103
|
*/
|
|
104
|
-
addOnceListener(callback: Function, owner?: Object
|
|
104
|
+
addOnceListener(callback: Function, owner?: Object): boolean;
|
|
105
105
|
/**
|
|
106
106
|
* Adds a one-time event listener that will be automatically removed after being triggered once.
|
|
107
107
|
* The listener will only be triggered if the event is pretended (simulated).
|
|
@@ -119,7 +119,7 @@ export default class Event {
|
|
|
119
119
|
* @returns {boolean} Returns true if listener was added successfully, false if callback is nil or duplicate
|
|
120
120
|
* @protected
|
|
121
121
|
*/
|
|
122
|
-
protected _addListener(callback: Function, owner?: any, isOnce?: boolean
|
|
122
|
+
protected _addListener(callback: Function, owner?: any, isOnce?: boolean, isPrepend?: boolean): boolean;
|
|
123
123
|
/**
|
|
124
124
|
* Removes a callback
|
|
125
125
|
* @param {Function} callback - The callback function to remove.
|
|
@@ -139,4 +139,4 @@ export default class Event {
|
|
|
139
139
|
removeAllListeners(owner?: any): this;
|
|
140
140
|
}
|
|
141
141
|
export { Event as EventType };
|
|
142
|
-
import Listener from
|
|
142
|
+
import Listener from './listener.js';
|
package/types/index.d.ts
CHANGED
package/types/listener.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export default class Listener {
|
|
|
9
9
|
* @param {function} callback - The function to be called when event is fired
|
|
10
10
|
* @param {boolean} [isOnce=false] - is a one time listener?
|
|
11
11
|
*/
|
|
12
|
-
constructor(event: Event, callback: Function, isOnce?: boolean
|
|
12
|
+
constructor(event: Event, callback: Function, isOnce?: boolean);
|
|
13
13
|
_event: import("./event.js").default;
|
|
14
14
|
_callback: Function;
|
|
15
15
|
_isOnce: boolean;
|
|
@@ -18,7 +18,7 @@ export default class Listener {
|
|
|
18
18
|
* Sets the owner of this listener.
|
|
19
19
|
* @param {*} owner - The owner object to be associated with this listener.
|
|
20
20
|
*/
|
|
21
|
-
set owner(
|
|
21
|
+
set owner(owner: any);
|
|
22
22
|
get owner(): any;
|
|
23
23
|
get event(): import("./event.js").default;
|
|
24
24
|
get isOnce(): boolean;
|
|
@@ -47,4 +47,4 @@ export { Listener as ListenerType };
|
|
|
47
47
|
/**
|
|
48
48
|
* Wraps a function to be called when an event is fired.
|
|
49
49
|
*/
|
|
50
|
-
export type Event = import(
|
|
50
|
+
export type Event = import("./event.js").default;
|