Open DavidANeil opened 8 months ago
In the meantime, here's how you can do it with the current API:
watcher.unwatch(...Signal.subtle.introspectSources(watcher));
Right, we could add this as a very small convenience, but it definitely doesn’t require any extra tracking to unwatch all sources, due to introspection. And you can look at the git history to see that we very recently did have such a Symbol.dispose method—I have gone back and forth in my thoughts on whether this is important.
A watcher should be easily disposable, without needing to track which signals it was previous watching. Using the (currently) stage 3 Symbol.dispose seems most appropriate.
Normative Spec Text
Method:
Signal.subtle.Watcher.prototype[Symbol.dispose]()
this.unwatch.apply(this, [[signals]])