UNPKG

ashish-sdk

Version:
25 lines 751 B
import { HostEvent } from '../types'; /** * Reloads the ThoughtSpot iframe. */ function reload(iFrame) { const oldFrame = iFrame.cloneNode(); const parent = iFrame.parentNode; parent.removeChild(iFrame); parent.appendChild(oldFrame); } /** * Post Iframe message. */ function postIframeMessage(iFrame, message, thoughtSpotHost) { return iFrame.contentWindow.postMessage(message, thoughtSpotHost); } export function processTrigger(iFrame, messageType, thoughtSpotHost, data) { switch (messageType) { case HostEvent.Reload: return reload(iFrame); default: return postIframeMessage(iFrame, { type: messageType, data }, thoughtSpotHost); } } //# sourceMappingURL=processTrigger.js.map