UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

42 lines (41 loc) 1.23 kB
import { struct as a } from "../../../utils/struct/main.js"; import { enumerable as e } from "../../../utils/struct/property.js"; import { isFunction as d, isUndefined as m } from "../../../utils/value/is.js"; import { noop as f } from "../../../utils/common.js"; const E = () => { const r = new class extends EventTarget { }(), l = (o, ...t) => { const [n] = t; t.length && m(n) && console.warn( "Unexpected value `undefined` provided for event detail.\n Turn off this warning by doing either of the following:\n (1) omit the optional event detail parameter.\n (2) explicitly pass `null` for the event detail parameter (instead of `undefined`).\n" ); const i = new CustomEvent( o, a({ bubbles: e(!1), cancelable: e(!1), detail: e(n ?? null) }) ); return r.dispatchEvent(i); }, s = (o, t) => { if (!d(t)) return f; const n = (i) => t.call( null, a({ detail: e(i.detail), timeStamp: e(i.timeStamp), type: e(i.type) }) ); return r.addEventListener(o, n), () => r.removeEventListener(o, n); }; return a({ emit: e(l), on: e(s) }); }; export { E as createEventEmitter, E as default };