Pattern: Use of Node.js-specific EventEmitter
Issue: -
Using EventTarget
instead of EventEmitter
reduces bundle size and improves cross-platform compatibility since EventTarget
is available in browsers, Deno, and Node.js, while EventEmitter
is Node.js-specific.
Example of incorrect code:
class Foo extends EventEmitter {}
Example of correct code:
class Foo extends EventTarget {}