let watcher
const a = new Signal.State(0, {
[Signal.subtle.watched]: () => {
watcher.unwatch(a)
},
})
watcher = new Signal.subtle.Watcher(() => {
console.log("notified")
});
watcher.watch(a);
a.set(1);
It's not clear from the specification what should happen here and it should probably be spelled out. In the event, the polyfill at f7c550b throws a RangeError from internal code and then leaves an inconsistent state - the watcher has a as a source but a does not have the watcher as a sync, is permissible in how the spec is currently worded but I suspect is not an invariant we want to break here.
Consider the following code:
It's not clear from the specification what should happen here and it should probably be spelled out. In the event, the polyfill at f7c550b throws a RangeError from internal code and then leaves an inconsistent state - the watcher has
a
as a source buta
does not have the watcher as a sync, is permissible in how the spec is currently worded but I suspect is not an invariant we want to break here.