Skip to content

Instantly share code, notes, and snippets.

@iliakan
Created July 17, 2020 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iliakan/5e2c082a2d237645ff09dc32fce51c0f to your computer and use it in GitHub Desktop.
Save iliakan/5e2c082a2d237645ff09dc32fce51c0f to your computer and use it in GitHub Desktop.
module.exports = class HtmlCodeRunner {
async run({ code, waitForResult, timeout }) {
const { port1, port2 } = new MessageChannel();
// .querySelector('#previewWorkerManagerFrame')
this.elem.contentWindow.postMessage(
{
command,
sandbox,
waitForResult,
timeout,
},
'*',
[port2]
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment