mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -08:00
async calls WIP
This commit is contained in:
11
src/index.js
11
src/index.js
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user