MCPcopy Create free account
hub / github.com/chatwoot/chatwoot / createEvent

Function createEvent

app/javascript/shared/helpers/CustomEventHelper.js:1–10  ·  view source on GitHub ↗
({ eventName, data = null })

Source from the content-addressed store, hash-verified

1export const createEvent = ({ eventName, data = null }) => {
2 let event;
3 if (typeof window.CustomEvent === 'function') {
4 event = new CustomEvent(eventName, { detail: data });
5 } else {
6 event = document.createEvent('CustomEvent');
7 event.initCustomEvent(eventName, false, false, data);
8 }
9 return event;
10};
11
12export const dispatchWindowEvent = ({ eventName, data }) => {
13 const event = createEvent({ eventName, data });

Callers 1

dispatchWindowEventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected