modularize playground (prep for persistent/modular file handling)

This commit is contained in:
2024-12-07 16:58:10 -08:00
parent 421f5ea208
commit ba70845c09
11 changed files with 673 additions and 193 deletions

View File

@@ -0,0 +1,31 @@
<html>
<head>
<script>
realLog = console.log
messages = []
console.log = (...args) => {
window.parent.postMessage({message: args.join(' ')}, '*')
// messages.push(args.join(' '))
realLog(...args)
}
window.addEventListener('message', (ev) => {
realLog('got', ev)
let {cmd, src} = ev.data
if (cmd === 'exec') {
try {
window.parent.postMessage({messages: []}, '*')
eval(src)
} catch (e) {
console.log(e)
}
}
// window.parent.postMessage({messages}, '*')
messages = []
})
realLog('IFRAME INITIALIZED')
</script>
</head>
<body>
</body>
</html>