@axijs/emitter 1.0.0 → 1.0.1
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 +2 -6
- package/dist/index.js +3 -7
- package/dist/index.mjs +3 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,12 +101,8 @@ masterSub.unsubscribe();
|
|
|
101
101
|
|
|
102
102
|
## API Documentation
|
|
103
103
|
|
|
104
|
-
For a complete list of classes, interfaces,
|
|
105
|
-
|
|
106
|
-
## License
|
|
107
|
-
|
|
108
|
-
MIT
|
|
109
|
-
```
|
|
104
|
+
For a complete list of classes, interfaces,
|
|
105
|
+
and methods, please visit the [API Documentation](https://github.com/axijs/tools/tree/main/packages/emitter/docs/api).
|
|
110
106
|
|
|
111
107
|
## License
|
|
112
108
|
|
package/dist/index.js
CHANGED
|
@@ -26,11 +26,6 @@ __export(index_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
29
|
-
// ../ensure/dist/index.mjs
|
|
30
|
-
function isFunction(value) {
|
|
31
|
-
return typeof value === "function";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
29
|
// src/subscription.ts
|
|
35
30
|
var Subscription = class {
|
|
36
31
|
_closed = false;
|
|
@@ -55,11 +50,12 @@ var Subscription = class {
|
|
|
55
50
|
* @param teardown A function or another Unsubscribable object to be managed.
|
|
56
51
|
*/
|
|
57
52
|
add(teardown) {
|
|
53
|
+
const isFunction = typeof teardown === "function";
|
|
58
54
|
if (this._closed) {
|
|
59
|
-
isFunction
|
|
55
|
+
isFunction ? teardown() : teardown.unsubscribe();
|
|
60
56
|
return;
|
|
61
57
|
}
|
|
62
|
-
this._teardowns.push(isFunction
|
|
58
|
+
this._teardowns.push(isFunction ? teardown : () => teardown.unsubscribe());
|
|
63
59
|
}
|
|
64
60
|
/**
|
|
65
61
|
* Disposes the resources held by the subscription.
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// ../ensure/dist/index.mjs
|
|
2
|
-
function isFunction(value) {
|
|
3
|
-
return typeof value === "function";
|
|
4
|
-
}
|
|
5
|
-
|
|
6
1
|
// src/subscription.ts
|
|
7
2
|
var Subscription = class {
|
|
8
3
|
_closed = false;
|
|
@@ -27,11 +22,12 @@ var Subscription = class {
|
|
|
27
22
|
* @param teardown A function or another Unsubscribable object to be managed.
|
|
28
23
|
*/
|
|
29
24
|
add(teardown) {
|
|
25
|
+
const isFunction = typeof teardown === "function";
|
|
30
26
|
if (this._closed) {
|
|
31
|
-
isFunction
|
|
27
|
+
isFunction ? teardown() : teardown.unsubscribe();
|
|
32
28
|
return;
|
|
33
29
|
}
|
|
34
|
-
this._teardowns.push(isFunction
|
|
30
|
+
this._teardowns.push(isFunction ? teardown : () => teardown.unsubscribe());
|
|
35
31
|
}
|
|
36
32
|
/**
|
|
37
33
|
* Disposes the resources held by the subscription.
|
package/package.json
CHANGED