primus / eventemitter3

EventEmitter3 - Because there's also a number 2. And we're faster.
MIT License
3.35k stars 226 forks source link

prependListener support #203

Open SachsKaylee opened 5 years ago

SachsKaylee commented 5 years ago

123 mentioned prependListener support and opted to not implement it back in late 2017.

This poses a problem as prependListener turns out to be quite quicial for our current project. preprendListener also seems to be a standard Node.js API function for event emitters: https://nodejs.org/api/events.html#events_emitter_prependlistener_eventname_listener

Is there a plan to suppot this feature in the near future? / Do you accept PRs for this?

//Edit:

For now I opted to create our own library with an API compatible with eventemitter3(It compiles and runs with Phaser3 which uses eventemitter3) which I alias in our webpack.config.js(alias: { 'eventemitter3': path.resolve(__dirname, './node_modules/sahnee-eventemitter') })

Instead of implementing the preprendListener function I went for a priority parameter here, which is not standard compilant by the looks of it but much more powerful. https://github.com/Sahnee-DE/eventemitter/blob/master/src/index.ts#L104

fabian-st commented 1 year ago

prependListener support would be much appreciated