Show HN: A simple JavaScript notebook in one file
github.com
github.com
You can enter Javascript code and execute it in the browser, completely locally and possibly offline. The performance can be pretty good.
You can put in HTML documentation and also use HTML to provide UI for simple tools.
All you need is the js+help.html file, which contains basic documentation. You can clear out the notebook and save off various javascript experiments in different files.
I have mostly used this with Chrome. I have tried it with Firefox, and also on various OSs (Linux/Windows/Mac). The main compatibility issue is the handling of the downloading of files and how that varies in different contexts.
I just recently modified this to work better for the mobile (small screen) case. I have done testing after these changes, but not extensive testing.
It is easy to extract a CSS and a JS file that could be stored separately to make for very small notebook files.
I deliberately chose the "Unlicense". (I might claim copyright, but only to discourage someone else from claiming copyright.) The coding style could probably be improved, but I wanted not to use new features to maintain compatibility with older browsers.
I will try to respond to comments and questions, but may be a little slow.
https://rawcdn.githack.com/timcwinkler/javascript-notebook/9...
(There must be some resource limits, but I don't know what they are. Maybe there aren't limits? This is fast.)
Here is a screen shot:
Simple screenshot:
https://github.com/timcwinkler/javascript-notebook/blob/main...
What you see if you load js+help.html:
https://github.com/timcwinkler/javascript-notebook/blob/main...
(Will the links work as I hoped? ... I am not disappointed.)
It's just more of a hint to you that, whenever you want to show something to the public, every extra action the user has to make, could lose you that user.
Keep in mind that "we" want to figure out in seconds if we want to spend more time looking at what you have created or not.
Fork it if you want, I will delete it then (or on your request)
Apparently the contents of the page were somehow mangled a bit. As a result it is not functional.
Thank you, benjaminsuch, for that pointer.
I wonder what "Files are automatically optimized" means, exactly?
Have tried this out.
(See comment https://news.ycombinator.com/item?id=27452226)
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!
I did try googling and reading about it.
HN enlighten us!
So at this point people have come to call this concept in general a "notebook". Basically a development environment with cells where you can add markup and HTML and stuff.
Hope that helped a bit.
I learned about how to make it easy to try a webpage from github which is useful.
I don't really have a lot invested in the result of this, but I have the feeling that people who are really trying to make a product must find that the spotlight of YC moves awfully fast.
I wonder if there needs to be a website that is a catalog of interesting projects (organized by purpose). Looking at github, it appears that it contains some lists of projects on github.
I have even modified the javascript code of the page itself and saved it away (not really directly supported).
I have added screenshots, a download link, and a more interesting example (mfib).
Will look into ways to make everything even easier.
And since they also generally support markdown, it doubles as documentation.
For simplicity, in js+help.html, not markdown, but plain HTML.