@dr.pogodin/js-utils 0.0.4 → 0.0.5
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/README.md +1 -1
- package/js/Emitter.d.ts +4 -0
- package/js/Emitter.js +6 -0
- package/package.json +3 -3
- package/ts/Emitter.ts +7 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/@dr.pogodin/js-utils)
|
|
7
7
|
[](https://app.circleci.com/pipelines/github/birdofpreyru/js-utils)
|
|
8
8
|
[](https://github.com/birdofpreyru/js-utils)
|
|
9
|
-
[](https://dr.pogodin.studio/docs/
|
|
9
|
+
[](https://dr.pogodin.studio/docs/js-utils)
|
|
10
10
|
|
|
11
11
|
The aim for this repo/package is to move in from the [React Utils] the pieces
|
|
12
12
|
which are not React-specific, thus are also useful cross non-React projects,
|
package/js/Emitter.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ export default class Emitter<T extends unknown[] = unknown[]> {
|
|
|
21
21
|
* @param args
|
|
22
22
|
*/
|
|
23
23
|
emit(...args: T): void;
|
|
24
|
+
/**
|
|
25
|
+
* Removes all connected listeners.
|
|
26
|
+
*/
|
|
27
|
+
removeAllListeners(): void;
|
|
24
28
|
/**
|
|
25
29
|
* Removes specified `listener`, if connected.
|
|
26
30
|
* @param listener
|
package/js/Emitter.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dr.pogodin/js-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Collection of JavaScript (TypeScript) utilities.",
|
|
5
5
|
"main": "js/index",
|
|
6
6
|
"react-native": "ts/index",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@babel/preset-typescript": "^7.21.5",
|
|
35
35
|
"@tsconfig/recommended": "^1.0.2",
|
|
36
36
|
"@types/jest": "^29.5.1",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^5.59.
|
|
38
|
-
"@typescript-eslint/parser": "^5.59.
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^5.59.6",
|
|
38
|
+
"@typescript-eslint/parser": "^5.59.6",
|
|
39
39
|
"babel-jest": "^29.5.0",
|
|
40
40
|
"eslint": "^8.40.0",
|
|
41
41
|
"eslint-config-airbnb-base": "^15.0.0",
|
package/ts/Emitter.ts
CHANGED
|
@@ -39,6 +39,13 @@ export default class Emitter<T extends unknown[] = unknown[]> {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Removes all connected listeners.
|
|
44
|
+
*/
|
|
45
|
+
removeAllListeners() {
|
|
46
|
+
this.p_listeners = [];
|
|
47
|
+
}
|
|
48
|
+
|
|
42
49
|
/**
|
|
43
50
|
* Removes specified `listener`, if connected.
|
|
44
51
|
* @param listener
|