@oscarpalmer/mora 0.6.0 → 0.7.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/package.json +1 -1
- package/src/computed.ts +10 -3
- package/src/effect.ts +1 -1
- package/src/signal.ts +10 -3
package/package.json
CHANGED
package/src/computed.ts
CHANGED
|
@@ -46,10 +46,10 @@ export class Computed<Value> {
|
|
|
46
46
|
if (!Object.is(this.state.value, value)) {
|
|
47
47
|
this.state.value = value;
|
|
48
48
|
|
|
49
|
-
for (const
|
|
50
|
-
|
|
49
|
+
for (const computed of this.state.computeds) {
|
|
50
|
+
computed.state.dirty = true;
|
|
51
51
|
|
|
52
|
-
dirtyEffects.add(
|
|
52
|
+
dirtyEffects.add(computed.state.effect);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
for (const effect of this.state.effects) {
|
|
@@ -84,6 +84,13 @@ export class Computed<Value> {
|
|
|
84
84
|
|
|
85
85
|
return this.state.value;
|
|
86
86
|
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get the value _(without reactivity)_
|
|
90
|
+
*/
|
|
91
|
+
peek(): Value {
|
|
92
|
+
return this.state.value;
|
|
93
|
+
}
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
/**
|
package/src/effect.ts
CHANGED
package/src/signal.ts
CHANGED
|
@@ -34,6 +34,13 @@ export class Signal<Value> {
|
|
|
34
34
|
return this.state.value;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Get the value _(without reactivity)_
|
|
39
|
+
*/
|
|
40
|
+
peek(): Value {
|
|
41
|
+
return this.state.value;
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
/**
|
|
38
45
|
* Set the value
|
|
39
46
|
*/
|
|
@@ -44,10 +51,10 @@ export class Signal<Value> {
|
|
|
44
51
|
|
|
45
52
|
this.state.value = value;
|
|
46
53
|
|
|
47
|
-
for (const
|
|
48
|
-
(
|
|
54
|
+
for (const computed of this.state.computeds) {
|
|
55
|
+
(computed as unknown as InternalComputed).state.dirty = true;
|
|
49
56
|
|
|
50
|
-
dirtyEffects.add((
|
|
57
|
+
dirtyEffects.add((computed as unknown as InternalComputed).state.effect);
|
|
51
58
|
}
|
|
52
59
|
|
|
53
60
|
for (const effect of this.state.effects) {
|