EventEmitter 类


EventEmitter 类由 node:events 模块定义和暴露:

    The EventEmitter class is defined and exposed by the node:events module:

    import { EventEmitter } from 'node:events';const EventEmitter = require('node:events');

    All EventEmitters emit the event 'newListener' when new listeners are added and 'removeListener' when existing listeners are removed.

    It supports the following option: