The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/lib/utils/fireGlobalEventBase.ts

18 lines
395 B

export const fireGlobalEventBase = (eventName: string, detail?: unknown) => {
window.dispatchEvent(new CustomEvent(eventName, { detail }));
const dispatchMessage = (iframeSendEnabled: boolean, sendTargetOrigin: string) => {
if (!iframeSendEnabled) {
return;
}
parent.postMessage(
{
eventName,
data: detail,
},
sendTargetOrigin,
);
};
return dispatchMessage;
};