UNPKG

gs-events

Version:

事件分发器(同步)

16 lines (13 loc) 365 B
import { Event, EventDispatcher } from ".."; class Node extends EventDispatcher { constructor() { super(); this.addEventListener("custom", this.handler); } handler( evt ) { console.log("scope:", this); console.log("event:", evt); } } let node = new Node(); node.dispatchEvent(new Event("custom", false, true));