reactronic 0.21.519 → 0.21.520

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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![CircleCI Status](https://circleci.com/gh/nezaboodka/reactronic.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/nezaboodka/reactronic)
7
7
  ![Coverage](https://img.shields.io/badge/coverage-97%25-success.svg)
8
8
  ![Lines](https://img.shields.io/badge/lines-1715-success.svg)
9
- [![Demo](https://img.shields.io/badge/demo-live-success.svg)](https://gitlab.com/nezaboodka/nevod.web.public/-/blob/master/README.md)
9
+ [![Demo](https://img.shields.io/badge/demo-live-success.svg)](https://gitlab.com/nezaboodka/nevod.website/-/blob/master/README.md)
10
10
 
11
11
  # **Reactronic** - Transactional Reactive State Management
12
12
 
@@ -27,8 +27,8 @@ export declare class Ref<T = any> {
27
27
  static similarRefs(v1: Ref, v2: Ref): boolean;
28
28
  }
29
29
  export declare class ToggleRef<T = boolean> extends Ref<T> {
30
- readonly value1: T;
31
- readonly value2: T;
32
- constructor(owner: any, name: string, value1: T, value2: T);
30
+ readonly valueOn: T;
31
+ readonly valueOff: T;
32
+ constructor(owner: any, name: string, valueOn: T, valueOff: T);
33
33
  toggle(): void;
34
34
  }
@@ -49,22 +49,22 @@ class Ref {
49
49
  }
50
50
  exports.Ref = Ref;
51
51
  class ToggleRef extends Ref {
52
- constructor(owner, name, value1, value2) {
52
+ constructor(owner, name, valueOn, valueOff) {
53
53
  super(owner, name);
54
- this.value1 = value1;
55
- this.value2 = value2;
54
+ this.valueOn = valueOn;
55
+ this.valueOff = valueOff;
56
56
  }
57
57
  toggle() {
58
58
  const o = this.owner;
59
59
  const p = this.name;
60
60
  Transaction_1.Transaction.runAs({ hint: `toggle ${o.constructor.name}.${p}` }, () => {
61
61
  const v = o[p];
62
- const isValue1 = v === this.value1 || (v instanceof Ref && this.value1 instanceof Ref &&
63
- Ref.sameRefs(v, this.value1));
64
- if (!isValue1)
65
- o[p] = this.value1;
62
+ const isOn = v === this.valueOn || (v instanceof Ref && this.valueOn instanceof Ref &&
63
+ Ref.sameRefs(v, this.valueOn));
64
+ if (!isOn)
65
+ o[p] = this.valueOn;
66
66
  else
67
- o[p] = this.value2;
67
+ o[p] = this.valueOff;
68
68
  });
69
69
  }
70
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactronic",
3
- "version": "0.21.519",
3
+ "version": "0.21.520",
4
4
  "description": "Reactronic - Transactional Reactive State Management",
5
5
  "main": "build/dist/source/api.js",
6
6
  "types": "build/dist/source/api.d.ts",