audiojs / web-audio-api

Node.js implementation of Web audio API
MIT License
817 stars 67 forks source link

Use EventTarget instead EventEmitter #85

Open chrisguttandin opened 2 years ago

chrisguttandin commented 2 years ago

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

dy commented 2 years ago

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.

chrisguttandin commented 2 years ago

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?

dy commented 2 years ago

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

chrisguttandin commented 2 years ago

I'm happy to hear that. :-)