browserify / events

Node's event emitter for all engines.
MIT License
1.38k stars 173 forks source link

Support AbortSignal #79

Closed feross closed 3 years ago

feross commented 3 years ago

An AbortSignal can be used to cancel waiting on events. See: https://nodejs.org/api/events.html#events_events_on_emitter_eventname_options

feross commented 3 years ago

Nevermind, this is dependent on first implementing events.on. See: https://github.com/browserify/events/issues/76

benjamingr commented 3 years ago

@feross would it help if Node just vendored events independently (like readable stream)?

It looks like events.js doesn't actually have any non-constant dependencies (other than event_target which is also pretty easy to fix)

goto-bus-stop commented 3 years ago

@benjamingr Part of the goal of this package is also to be compatible with old browsers (except for the Promise functions). If events could be vendored independently and compiled down for browsers just like readable-stream is, I think that would be amazing :)

benjamingr commented 3 years ago

Opened https://github.com/nodejs/node/issues/37435 - let me know if this is something you'd like to collaborate on.

It's basically a script that "rips out" events from Node's lib folder and shims core-related things (not many)