by protoduction · 5y ago · 0 comments
If you're looking for next steps: You can actually run user code using `import`, which will allow your users to import code from external websites using familiar `import {x} from "https://some-url.com/bla.js"` syntax at the top of cells. Here's how:
const exportsInCell = await import(URL.createObjectURL(new Blob([USER_CODE], { type: "text/javascript" })));
And with some transpilation you can support top-level await in eval [1]. Just some pointers![0]: https://starboard.gg & https://github.com/gzuidhof/starboard-notebook
[1]: https://github.com/gzuidhof/starboard-notebook/blob/master/s...
I have experimented with async/await with js+help.html.
The import pointer is very interesting, thank you for that.
My impulse is to try to write a function to import a code from a URI.
https://starboard.gg/timcwinkler/mfib-nC0Am5G
Very nice looking!
One difference from js+help.html, with it outputs are also saved.
Edit: Suddenly got both!