UNPKG

@whatwg-node/events

Version:

Cross Platform Smart Event API Ponyfill

17 lines (16 loc) 549 B
export const CustomEvent = globalThis.CustomEvent || class PonyfillCustomEvent extends Event { detail = null; constructor(type, eventInitDict) { super(type, eventInitDict); if (eventInitDict?.detail != null) { this.detail = eventInitDict.detail; } } initCustomEvent(type, bubbles, cancelable, detail) { this.initEvent(type, bubbles, cancelable); if (detail != null) { this.detail = detail; } } };