Restructure omni services and add Chatwoot research snapshot
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
export const createEvent = ({ eventName, data = null }) => {
|
||||
let event;
|
||||
if (typeof window.CustomEvent === 'function') {
|
||||
event = new CustomEvent(eventName, { detail: data });
|
||||
} else {
|
||||
event = document.createEvent('CustomEvent');
|
||||
event.initCustomEvent(eventName, false, false, data);
|
||||
}
|
||||
return event;
|
||||
};
|
||||
|
||||
export const dispatchWindowEvent = ({ eventName, data }) => {
|
||||
const event = createEvent({ eventName, data });
|
||||
window.dispatchEvent(event);
|
||||
};
|
||||
Reference in New Issue
Block a user