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/app/ui-utils/client/lib/fireGlobalEvent.js

21 lines
558 B

import { Tracker } from 'meteor/tracker';
import { settings } from '../../../settings';
export const fireGlobalEvent = function _fireGlobalEvent(eventName, params) {
window.dispatchEvent(new CustomEvent(eventName, { detail: params }));
Tracker.autorun((computation) => {
const enabled = settings.get('Iframe_Integration_send_enable');
if (enabled === undefined) {
return;
}
computation.stop();
if (enabled) {
parent.postMessage({
eventName,
data: params,
}, settings.get('Iframe_Integration_send_target_origin'));
}
});
};