Skip to content

Commit

Permalink
use instanceof instead of bit flags
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyw committed Oct 6, 2022
1 parent 939382e commit de43391
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ const DISPOSED = 1 << 3;
const HAS_ERROR = 1 << 4;
const TRACKING = 1 << 5;

// Flags that identify the kind of Signal
const COMPUTED_KIND = 1 << 6;

// Flags for Nodes.
const NODE_FREE = 1 << 0;
const NODE_SUBSCRIBED = 1 << 1;
Expand Down Expand Up @@ -291,7 +288,7 @@ Object.defineProperty(Signal.prototype, "value", {
return this._value;
},
set(this: Signal, value) {
if (evalContext && evalContext._flags & COMPUTED_KIND) {
if (evalContext instanceof Computed) {
mutationDetected();
}

Expand Down Expand Up @@ -412,7 +409,7 @@ function Computed(this: Computed, compute: () => unknown) {
this._compute = compute;
this._sources = undefined;
this._globalVersion = globalVersion - 1;
this._flags = OUTDATED | COMPUTED_KIND;
this._flags = OUTDATED;
}

Computed.prototype = new Signal() as Computed;
Expand Down

0 comments on commit de43391

Please sign in to comment.