Open curran opened 4 years ago
Something to study https://github.com/porsager/flems
Partial solution from https://github.com/datavis-tech/magic-sandbox/pull/10/files
window.console_log_native = window.console.log
window.console.log = function(){
try {
window.parent.postMessage({type: "console-log", message: [...arguments]}, "` + window.location.origin + `")
}
catch(err){
window.parent.postMessage({type: "console-fail"}, "` + window.location.origin + `")
}
if (!${supress_console_log}){
window.console_log_native(...arguments)
}
Svelte REPL reference implementation https://github.com/sveltejs/svelte-repl/blob/2cddc8695973c99e5b32d0f5a8f56125690039e5/src/Output/srcdoc/index.html#L84