Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const CustomEvent = (event, params) => {
- const evt = document.createEvent('CustomEvent');
- params = params || {
- bubbles: false,
- cancelable: false
- };
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
- return evt;
- };
- if (typeof window.CustomEvent !== 'function') {
- CustomEvent.prototype = window.Event.prototype;
- window.CustomEvent = CustomEvent;
- }
- window.triggerDTMEvent = eventName => {
- document.body.dispatchEvent(new window.CustomEvent(eventName));
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement