-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EventTarget, Observer, and toArray, last, etc #149
Comments
Note that the signal can already be passed in for all Promise-returning operators, which is the right place for it since it's a per-subscription signal. I really don't think you want to pass the signal into Now as for const controller = new AbortController();
eventTarget.on('foo').take(1).toArray({signal: controller.signal}); See #65 (comment), #66, and to a lesser extent, #75. Thoughts? |
Erroring and completing are quite different alternatives, like is the intention here to still get the array? If so my suggestion const array = eventTarget.on("foo").takeUntil(ac.signal).toArray(); If the intention is just to reject the promise with the abort reason, then |
I think we've addressed everything in the OP, and there hasn't been any more activity here so I'm going to close this out. |
With the current definition of the
EventTarget
integration, there's currently no mechanism for ending the stream of events, making things likeawait observer.toArray()
orawait observer.last()
problematic if not used together with one of the limiting functions likeobserver.take(2)
. There really needs to be a way of signaling that the subscription to the event stream has concluded. This can be done, I think, with allowing theonce
andsignal
options to be passed into theEventTarget.prototype.on(...)
options alongsidecapture
andpassive
.The text was updated successfully, but these errors were encountered: