Revert "Add telemetry for OpenTerminal success/failure (#192)" (#198)

This reverts commit 83b13de685.
This commit is contained in:
Tanuj Mittal
2020-09-11 23:12:28 -07:00
committed by GitHub
parent 728eeefa17
commit c4257bf4a9
3 changed files with 18 additions and 48 deletions

View File

@@ -48,31 +48,16 @@ export function sendCachedDataMessage<TResponseDataModel>(
export function sendMessage(data: any): void {
if (canSendMessage()) {
const dataExplorerWindow = getDataExplorerWindow();
if (dataExplorerWindow) {
dataExplorerWindow.parent.postMessage(
{
signature: "pcIframe",
data: data
},
dataExplorerWindow.document.referrer
);
}
window.parent.postMessage(
{
signature: "pcIframe",
data: data
},
window.document.referrer
);
}
}
const getDataExplorerWindow = (): Window => {
// Traverse up the window to find a window with `dataExplorerPlatform` property
let dataExplorerWindow: Window = window;
// TODO: Need to `any` here since the window imports Explorer which can't be in strict mode yet
// eslint-disable-next-line @typescript-eslint/no-explicit-any
while (!(dataExplorerWindow as any).dataExplorerPlatform && dataExplorerWindow.parent) {
dataExplorerWindow = dataExplorerWindow.parent;
}
return dataExplorerWindow;
};
export function canSendMessage(): boolean {
return window.parent !== window;
}