@arc-publishing/sdk-identity
Version:
JS Identity SDK for working with Identity API
28 lines • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.fireEvent = void 0;
var CustomEventPolyfill = function (event, params) {
if (params === void 0) { params = { bubbles: false, cancelable: false, detail: null }; }
if (!document) {
return;
}
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
};
if (typeof Event !== 'undefined') {
CustomEventPolyfill.prototype = Event.prototype;
}
var fireEvent = function (name, params) {
if (params === void 0) { params = {}; }
if (typeof window !== 'undefined') {
if (!window.CustomEvent || typeof window.CustomEvent !== 'function') {
window.CustomEvent = CustomEventPolyfill;
}
var CustomEventConstructor = CustomEvent || window.CustomEvent;
var event_1 = new CustomEventConstructor(name, params);
window.dispatchEvent(event_1);
}
};
exports.fireEvent = fireEvent;
//# sourceMappingURL=events.js.map