web-audio-api icon indicating copy to clipboard operation
web-audio-api copied to clipboard

Use EventTarget instead EventEmitter

Open chrisguttandin opened this issue 3 years ago • 4 comments

As of recently Node.js supports the same (or similar) EventTarget as the browser. Since the Web Audio spec is also referring to the EventTarget in various places it might be worth considering to replace the current EventEmitter usage.

https://nodejs.org/dist/latest-v16.x/docs/api/events.html#eventtarget-and-event-api

chrisguttandin avatar Feb 08 '22 07:02 chrisguttandin

If you'd like to take some features under your control - feel free. There's plenty of work tbd, you have great experience with it. I want to focus on dsp layer - it needs careful thought.

dy avatar Feb 08 '22 09:02 dy

I gathered some further information. EventTarget is supported since v14.5.0 of Node.js but v12.x is still actively maintained until mid April. Maybe we should at least wait until then.

I discovered that web-audio-api claims to support Node.js v4+. Maybe that should be changed. :-) https://github.com/audiojs/web-audio-api/blob/master/package.json#L36

Should we switch from EventEmitter to EventTarget to implement the spec as close as possible or would you prefer to support both?

chrisguttandin avatar Feb 15 '22 20:02 chrisguttandin

Nah, totally fine dropping old stuff. Not planning to do any backwards-compat. v1 should be fresh new, with ESM and good architecture.

dy avatar Feb 15 '22 20:02 dy

I'm happy to hear that. :-)

chrisguttandin avatar Feb 15 '22 20:02 chrisguttandin