* Associate a change to a given source with the current * batch, noting its previous and current values * @param {Value} source * @param {any} value * @param {boolean} [is_derived]
(source, value, is_derived = false)
| 576 | * @param {boolean} [is_derived] |
| 577 | */ |
| 578 | capture(source, value, is_derived = false) { |
| 579 | if (source.v !== UNINITIALIZED && !this.previous.has(source)) { |
| 580 | this.previous.set(source, source.v); |
| 581 | } |
| 582 | |
| 583 | // Don't save errors in `batch_values`, or they won't be thrown in `runtime.js#get` |
| 584 | if ((source.f & ERROR_VALUE) === 0) { |
| 585 | this.current.set(source, [value, is_derived]); |
| 586 | batch_values?.set(source, value); |
| 587 | } |
| 588 | |
| 589 | if (!this.is_fork) { |
| 590 | source.v = value; |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | activate() { |
| 595 | current_batch = this; |
no test coverage detected