in lib/frame.ts [6:28]
constructor() {
this.connection = new Connection(
window.parent.postMessage.bind(window.parent),
listener => {
const sourceCheckListener = (event: MessageEvent) => {
if (event.source !== window.parent) {
return;
}
return listener(event);
};
window.addEventListener('message', sourceCheckListener);
}
);
this.connection.setServiceMethods({
runCode: (code: string) => this.runCode(code),
importScript: (path: string) => this.importScript(path),
injectStyle: (style: string) => this.injectStyle(style),
importStyle: (path: string) => this.importStyle(path)
});
this.connection.callRemoteServiceMethod('iframeInitialized');
}