@thi.ng/api 8.4.6 → 8.5.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/CHANGELOG.md +7 -1
- package/README.md +1 -1
- package/event.d.ts +14 -1
- package/mixins/inotify.d.ts +1 -1
- package/mixins/inotify.js +5 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2022-11-
|
|
3
|
+
- **Last updated**: 2022-11-28T13:36:49Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [8.5.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.5.0) (2022-11-28)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add boolean result for INotifiy.notify(), update mixin ([f4cb33a](https://github.com/thi-ng/umbrella/commit/f4cb33a))
|
|
17
|
+
|
|
12
18
|
### [8.4.5](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.4.5) (2022-11-01)
|
|
13
19
|
|
|
14
20
|
#### 🩹 Bug fixes
|
package/README.md
CHANGED
package/event.d.ts
CHANGED
|
@@ -16,6 +16,19 @@ export interface Event extends IID<PropertyKey> {
|
|
|
16
16
|
export interface INotify {
|
|
17
17
|
addListener(id: string, fn: Listener, scope?: any): boolean;
|
|
18
18
|
removeListener(id: string, fn: Listener, scope?: any): boolean;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Broadcasts all registered listeners for given event type (in order
|
|
21
|
+
* registration) and returns true if any of them have been successfully
|
|
22
|
+
* notified.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* If a listener canceled the event (by setting {@link Event.canceled}), the
|
|
26
|
+
* function will stop notifying other listeners and return false. If no
|
|
27
|
+
* listeners are registered for the event, the function will also return
|
|
28
|
+
* false.
|
|
29
|
+
*
|
|
30
|
+
* @param event
|
|
31
|
+
*/
|
|
32
|
+
notify(event: Event): boolean;
|
|
20
33
|
}
|
|
21
34
|
//# sourceMappingURL=event.d.ts.map
|
package/mixins/inotify.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Event } from "../event.js";
|
|
2
|
-
export declare const inotify_dispatch: (listeners: any[][], e: Event) =>
|
|
2
|
+
export declare const inotify_dispatch: (listeners: any[][], e: Event) => boolean;
|
|
3
3
|
/**
|
|
4
4
|
* Mixin class decorator, injects INotify default implementation, incl.
|
|
5
5
|
* a lazily instantiated `_listeners` property object, storing
|
package/mixins/inotify.js
CHANGED
|
@@ -2,14 +2,15 @@ import { EVENT_ALL } from "../api.js";
|
|
|
2
2
|
import { mixin } from "../mixin.js";
|
|
3
3
|
export const inotify_dispatch = (listeners, e) => {
|
|
4
4
|
if (!listeners)
|
|
5
|
-
return;
|
|
5
|
+
return false;
|
|
6
6
|
for (let i = 0, n = listeners.length, l; i < n; i++) {
|
|
7
7
|
l = listeners[i];
|
|
8
8
|
l[0].call(l[1], e);
|
|
9
9
|
if (e.canceled) {
|
|
10
|
-
return;
|
|
10
|
+
return false;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
+
return true;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* Mixin class decorator, injects INotify default implementation, incl.
|
|
@@ -46,8 +47,8 @@ export const INotifyMixin = mixin({
|
|
|
46
47
|
if (!(listeners = this._listeners))
|
|
47
48
|
return false;
|
|
48
49
|
e.target === undefined && (e.target = this);
|
|
49
|
-
inotify_dispatch(listeners[e.id], e);
|
|
50
|
-
inotify_dispatch(listeners[EVENT_ALL], e);
|
|
50
|
+
const res = inotify_dispatch(listeners[e.id], e);
|
|
51
|
+
return inotify_dispatch(listeners[EVENT_ALL], e) || res;
|
|
51
52
|
},
|
|
52
53
|
__listener(listeners, f, scope) {
|
|
53
54
|
let i = listeners.length;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.0",
|
|
4
4
|
"description": "Common, generic types, interfaces & mixins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -222,5 +222,5 @@
|
|
|
222
222
|
"default": "./watch.js"
|
|
223
223
|
}
|
|
224
224
|
},
|
|
225
|
-
"gitHead": "
|
|
225
|
+
"gitHead": "75ec32ff7f1b7b5e72e7a04ace24732cd5d6c774\n"
|
|
226
226
|
}
|