async calls WIP

This commit is contained in:
Dmitry Vasilev
2022-10-26 13:11:51 +08:00
parent a78ba0fa78
commit c3365fe1ee
8 changed files with 112 additions and 19 deletions

View File

@@ -10,6 +10,17 @@ const EXAMPLE = `const fib = n =>
: fib(n - 1) + fib(n - 2)
fib(6)`
// By default run code in hidden iframe, until user explicitly opens visible
// window
globalThis.run_window = (() => {
const iframe = document.createElement('iframe')
iframe.src = 'about:blank'
iframe.setAttribute('hidden', '')
document.body.appendChild(iframe)
return iframe.contentWindow
})()
export const open_run_window = () => {
if(globalThis.run_window != null) {
globalThis.run_window.close()