rhaiscript / playground

A Rhai scripting playground that runs Rhai scripts using WebAssembly in a web browser.
https://rhai.rs/playground
MIT License
20 stars 5 forks source link

Allow integration from external web pages (e.g. Rhai book) #2

Open alvinhochun opened 4 years ago

alvinhochun commented 4 years ago

My idea of such integration would be to provide a page to be embedded via an <iframe>. A piece of JavaScript can be used to set the initial code from the embedding page (probably with postMessage) as the URI might not have enough space to include the full script.

Sometimes the embedding page might want to provide custom modules as Rhai script, or perhaps they have a customized playground build that provides some custom functions in Rust and would like to switch them on or off (e.g. some sections in the Rhai book showcases some engine customizations). The embeddable playground should also provide an option for this.