WICG / observable

Observable API proposal
https://wicg.github.io/observable/
Other
575 stars 14 forks source link

Use a restricted version of `AddEventListenerOptions`? #66

Closed domfarolino closed 1 year ago

domfarolino commented 1 year ago

The current explainer takes an AddEventListenerOptions dictionary on EventTarget#on, which gives us:

I think capture and passive definitely make sense for Observables, but once and signal feel weird. The once parameter feels redundant with take(1) (or maybe first() which is currently commented-out in our IDL sketch, but maybe it'll make it into the final one...), and signal definitely seems redundant with with the signal that subscribe would get in subscribe({signal}), and it isn't really clear how the "outer" signal (passed in via AddEventListenerOptions) would even work... I don't think it could be used to remove the event listener, because that would be what the subscriber's signal would be used for. Maybe it'd be used to somehow "cancel" many subscribers to a single observable all at once? Not sure how that'd work. My proposal is that we get rid of these two members from our proposal by using a restricted dictionary that doesn't include them.