@@ -512,24 +512,28 @@ frameborder="1"
512512 console.log (" loadWorkspace(workspaceName) - load a workspace from localStorage, e.g. loadWorkspace('combinators3')" );
513513 }
514514
515+ // Allow using browser console through an iframe on itch.io
515516 window.addEventListener ('message', event = > {
516517 //console.log (event);
517518 if (event.origin !== " https://bntr.itch.io" ) return;
518519 const method = event.data [0];
519520 if (method === " addItem" ) {
520521 addItem(event.data [1]);
521- } else if (method === " v " ) {
522+ } else if (method === " clearWorkspace " ) {
522523 clearWorkspace();
523524 } else if (method === " saveWorkspace" ) {
524525 saveWorkspace(event.data [1])
525526 } else if (method === " loadWorkspace" ) {
526527 loadWorkspace(event.data [1]);
527528 }
528529 });
529- // Use on itch.io in browser console:
530- //> var w = document.getElementById (" game_drop" ).contentWindow ;
531- //> w.postMessage (['addItem','\\x.x x'], '*')
532- //> w.postMessage (['clearWorkspace'], '*')
530+
531+ // Then in browser console:
532+ //> function vl(...args ) { document.getElementById (" game_drop" ).contentWindow.postMessage (args, " *" ) }
533+ //> vl('addItem','MULT 2 (\\f x. f (f x))')
534+ //> vl('clearWorkspace')
535+ //> vl('saveWorkspace', 'combinators3')
536+ //> vl('loadWorkspace', 'combinators3')
533537
534538 </script>
535539
0 commit comments