@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 CHANGED
@@ -52,5 +52,5 @@
52
52
  },
53
53
  "type": "module",
54
54
  "types": "./types/index.d.ts",
55
- "version": "0.6.0"
55
+ "version": "0.7.0"
56
56
  }
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 comp of this.state.computeds) {
50
- comp.state.dirty = true;
49
+ for (const computed of this.state.computeds) {
50
+ computed.state.dirty = true;
51
51
 
52
- dirtyEffects.add(comp.state.effect);
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
@@ -9,7 +9,7 @@ type InternalEffect = {
9
9
  };
10
10
 
11
11
  export class Effect {
12
- private readonly state: EffectState;
12
+ private declare readonly state: EffectState;
13
13
 
14
14
  constructor(callback: GenericCallback) {
15
15
  this.state = {
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 comp of this.state.computeds) {
48
- (comp as unknown as InternalComputed).state.dirty = true;
54
+ for (const computed of this.state.computeds) {
55
+ (computed as unknown as InternalComputed).state.dirty = true;
49
56
 
50
- dirtyEffects.add((comp as unknown as InternalComputed).state.effect);
57
+ dirtyEffects.add((computed as unknown as InternalComputed).state.effect);
51
58
  }
52
59
 
53
60
  for (const effect of this.state.effects) {