vivth 0.11.1 → 0.11.2
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 +1 -1
- package/src/class/$.mjs +3 -3
- package/src/class/Derived.mjs +12 -7
- package/src/class/Signal.mjs +1 -1
- package/types/src/class/$.d.mts +4 -2
- package/types/src/class/Derived.d.mts +4 -2
package/package.json
CHANGED
package/src/class/$.mjs
CHANGED
|
@@ -38,7 +38,7 @@ export class $ {
|
|
|
38
38
|
$.effects.set(this, new Set());
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
41
|
-
* @type {()=>void}
|
|
41
|
+
* @type {(arg0:{remove$:()=>void})=>void}
|
|
42
42
|
*/
|
|
43
43
|
effect;
|
|
44
44
|
/**
|
|
@@ -49,9 +49,9 @@ export class $ {
|
|
|
49
49
|
new PingFIFO(async () => {
|
|
50
50
|
$.isRegistering = true;
|
|
51
51
|
if (isAsync(effect)) {
|
|
52
|
-
await effect();
|
|
52
|
+
await effect({ remove$: this.remove$ });
|
|
53
53
|
} else {
|
|
54
|
-
effect();
|
|
54
|
+
effect({ remove$: this.remove$ });
|
|
55
55
|
}
|
|
56
56
|
$.isRegistering = false;
|
|
57
57
|
const signalInstances = $.activeSignal;
|
package/src/class/Derived.mjs
CHANGED
|
@@ -16,17 +16,22 @@ import { isAsync } from '../common.mjs';
|
|
|
16
16
|
*/
|
|
17
17
|
export class Derived extends Signal {
|
|
18
18
|
/**
|
|
19
|
-
* @param {()=>V} derivedFunction
|
|
19
|
+
* @param {(arg0:{remove$:()=>void})=>V} derivedFunction
|
|
20
20
|
*/
|
|
21
21
|
constructor(derivedFunction) {
|
|
22
|
-
|
|
23
|
-
super(0);
|
|
22
|
+
super(undefined);
|
|
24
23
|
const real = isAsync(derivedFunction)
|
|
25
|
-
?
|
|
26
|
-
|
|
24
|
+
? /**
|
|
25
|
+
* @param {{remove$:()=>void}} options
|
|
26
|
+
*/
|
|
27
|
+
async (options) => {
|
|
28
|
+
super.value = await derivedFunction(options);
|
|
27
29
|
}
|
|
28
|
-
:
|
|
29
|
-
|
|
30
|
+
: /**
|
|
31
|
+
* @param {{remove$:()=>void}} options
|
|
32
|
+
*/
|
|
33
|
+
(options) => {
|
|
34
|
+
super.value = derivedFunction(options);
|
|
30
35
|
};
|
|
31
36
|
new $(real);
|
|
32
37
|
}
|
package/src/class/Signal.mjs
CHANGED
package/types/src/class/$.d.mts
CHANGED
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export class Derived<V> extends Signal<V> {
|
|
12
12
|
/**
|
|
13
|
-
* @param {()=>V} derivedFunction
|
|
13
|
+
* @param {(arg0:{remove$:()=>void})=>V} derivedFunction
|
|
14
14
|
*/
|
|
15
|
-
constructor(derivedFunction: (
|
|
15
|
+
constructor(derivedFunction: (arg0: {
|
|
16
|
+
remove$: () => void;
|
|
17
|
+
}) => V);
|
|
16
18
|
}
|
|
17
19
|
import { Signal } from './Signal.mjs';
|