easy-signal 5.0.3 → 5.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/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/signal.js +5 -1
- package/dist/signal.js.map +1 -1
- package/dist/store.d.ts +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -3
- package/src/signal.ts +5 -2
- package/src/store.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './debounce';
|
|
2
|
-
export * from './signal';
|
|
3
|
-
export * from './store';
|
|
1
|
+
export * from './debounce.js';
|
|
2
|
+
export * from './signal.js';
|
|
3
|
+
export * from './store.js';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './debounce';
|
|
2
|
-
export * from './signal';
|
|
3
|
-
export * from './store';
|
|
1
|
+
export * from './debounce.js';
|
|
2
|
+
export * from './signal.js';
|
|
3
|
+
export * from './store.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
package/dist/signal.d.ts
CHANGED
package/dist/signal.js
CHANGED
|
@@ -30,7 +30,11 @@ export function signal() {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
signal.emit = async (...args) => {
|
|
33
|
-
await Promise.allSettled(Array.from(subscribers).map(listener => listener(...args)));
|
|
33
|
+
const results = await Promise.allSettled(Array.from(subscribers).map(listener => listener(...args)));
|
|
34
|
+
for (const result of results) {
|
|
35
|
+
if (result.status === 'rejected')
|
|
36
|
+
Promise.reject(result.reason);
|
|
37
|
+
}
|
|
34
38
|
};
|
|
35
39
|
signal.emitError = async (error) => {
|
|
36
40
|
await Promise.allSettled(Array.from(errorListeners).map(listener => listener(error)));
|
package/dist/signal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal.js","sourceRoot":"","sources":["../src/signal.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,MAAM;IACpB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAoB,CAAC;IAChD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAmB,CAAC;IAElD,SAAS,MAAM,CAAC,UAAa;QAC3B,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5B,OAAO,GAAG,EAAE;YACV,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACjC,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,GAAG,IAAa,EAAE,EAAE;QACvC,MAAM,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"signal.js","sourceRoot":"","sources":["../src/signal.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,MAAM;IACpB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAoB,CAAC;IAChD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAmB,CAAC;IAElD,SAAS,MAAM,CAAC,UAAa;QAC3B,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5B,OAAO,GAAG,EAAE;YACV,WAAW,CAAC,MAAM,CA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|
2
2
|
type StartStopNotifier<T> = (set: Subscriber<T>, update: (fn: Updater<T>) => void) => Unsubscriber | void;
|
|
3
3
|
export type Updater<T> = (value: T) => T;
|
|
4
4
|
export type { Subscriber, Unsubscriber };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-signal",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"description": "Two types of signals: event signals for subscribing to and emitting events, and reactive store signals for tracking and reacting to state changes.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './debounce';
|
|
2
|
-
export * from './signal';
|
|
3
|
-
export * from './store';
|
|
1
|
+
export * from './debounce.js';
|
|
2
|
+
export * from './signal.js';
|
|
3
|
+
export * from './store.js';
|
package/src/signal.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Unsubscriber } from './types';
|
|
1
|
+
import type { Unsubscriber } from './types.js';
|
|
2
2
|
|
|
3
3
|
export type SignalSubscriber = (...args: any[]) => any;
|
|
4
4
|
export type ErrorSubscriber = (error: Error) => any;
|
|
@@ -47,7 +47,10 @@ export function signal<T extends SignalSubscriber = SignalSubscriber>(): Signal<
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
signal.emit = async (...args: Args<T>) => {
|
|
50
|
-
await Promise.allSettled(Array.from(subscribers).map(listener => listener(...args)));
|
|
50
|
+
const results = await Promise.allSettled(Array.from(subscribers).map(listener => listener(...args)));
|
|
51
|
+
for (const result of results) {
|
|
52
|
+
if (result.status === 'rejected') Promise.reject(result.reason);
|
|
53
|
+
}
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
signal.emitError = async (error: Error) => {
|
package/src/store.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Subscriber, Unsubscriber } from './types';
|
|
1
|
+
import type { Subscriber, Unsubscriber } from './types.js';
|
|
2
2
|
type Invalidator = () => void;
|
|
3
3
|
type StartStopNotifier<T> = (set: Subscriber<T>, update: (fn: Updater<T>) => void) => Unsubscriber | void;
|
|
4
4
|
export type Updater<T> = (value: T) => T;
|