import { EventEmitter } from "node:events";
/**
* add "type":"module" in package.json
*/
class MyEmitter extends EventEmitter {}
const myEvent = new MyEmitter();
myEvent.on("event", () => {
console.log("an event occurred!");
});
myEvent.emit("event");