EventTarget 和 Event API


¥EventTarget and Event API

EventTargetEvent 对象是 EventTarget 网络应用接口 的特定于 Node.js 的实现,由一些 Node.js 核心 API 公开。

¥The EventTarget and Event objects are a Node.js-specific implementation of the EventTarget Web API that are exposed by some Node.js core APIs.

const target = new EventTarget();

target.addEventListener('foo', (event) => {
  console.log('foo event happened!');
});