(value: A)
| 683 | } |
| 684 | |
| 685 | setValue(value: A): void { |
| 686 | if ((this.state & NodeFlags.initialized) === 0) { |
| 687 | this.state = NodeState.valid |
| 688 | this._value = value |
| 689 | |
| 690 | if (batchState.phase === BatchPhase.collect) { |
| 691 | batchState.notify.add(this) |
| 692 | } else { |
| 693 | this.notify() |
| 694 | } |
| 695 | |
| 696 | return |
| 697 | } |
| 698 | |
| 699 | this.state = NodeState.valid |
| 700 | if (this.atom.equals(this._value, value)) { |
| 701 | return |
| 702 | } |
| 703 | |
| 704 | this._value = value |
| 705 | if (this.skipInvalidation) { |
| 706 | this.skipInvalidation = false |
| 707 | } else { |
| 708 | this.invalidateChildren() |
| 709 | } |
| 710 | |
| 711 | if (this.listeners.size > 0) { |
| 712 | if (batchState.phase === BatchPhase.collect) { |
| 713 | batchState.notify.add(this) |
| 714 | } else { |
| 715 | this.notify() |
| 716 | } |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | addParent(parent: NodeImpl<any>): void { |
| 721 | this.parents.add(parent) |
no test coverage detected