Been using Tonic for a few months now and it's been very useful and incredibly easy to test things out.
Tested out an idea quickly with Twilio, demoed an API in another notebook, and prototyped a new feature from my iPad while on an airplane (that's my favorite part).
It's been really useful for me and now that I can embed it into my blog posts or in the documentation is going to be really helpful for the rest of our team. Awesome work guys!
I looked at the docs at https://tonicdev.com/docs/embed#api and it seemed pretty sparse. I would suggest several simple use-cases that are very very common across many websites, esp those that wouldnt have an active back-end:
1. Contact form catcher
2. Grab user email for email list
3. Referral Form that saves to...say...parse or some standard backend?
I actually used tonicdev last when I was messing around with promise chains and trying to get better with bluebird, and was discouraged when things that worked on my native REPL weren't working on the equivalent node version on tonicdev. It's still a really awesome tool though.
When the same thing happened to me, it turned out I had a `ReferenceError` higher up in the code. Tonicdev notebook will stop evaluating code as soon as an error occurs, like any regular JavaScript program would.
Even though your code blocks are separated, and text appears between them, it's all one contiguous block of code.
Yeah, we are working on providing better errors, we know they can sometimes be confusing. They're slightly better now but they should get substantially more helpful soon.
I went back to find the document in question to make sure it wasn't user error, and I think ziad-saab was correct, I removed a cell above it and I got the correct response. The cell above it didn't have any error indications though so I assumed it was working OK
Probably this is because I'm being daft but I honestly can't figure out what Tonic even is. It seems like a data visualization framework, but then it seems to be a package manager or something? I clicked around and tried to find a simple few sentence summary and then gave up.
It has data visualization features, and it also manages npm packages for you, but those are just features. Another way to think of it is, a different (hopefully better) version of the thing you'd get if you just typed "node" in your terminal.
Sorry for the confusion, not sure what a "true embed of node" on a webpage would be. "Replicating node" certainly wouldn't be either, I suppose the only thing that would be truly embedding node is compiling the node binary with emscripten or NaCL? If that's what you were thinking then no, we are allowing you to embed "node source code examples" into a webpage that users can run.
a "true embed" would be something like Electron, that's running a node instance on the client, and can work independently without any interaction with a server.
We're using the word "embed" in what I feel like is a pretty generically understood web term of "take this external thing and embed it in your page".
The actual thing you are embedding is a version of our app, Tonic, which yes interfaces remotely with Node.js. I think this title is the best way of getting the idea across in a few words though.
It doesn't seem to be running in the client's JavaScript engine. It sounds like they are sending the source to an API, evaluating, and returning the result.
Yes, it's done automatically. We actually have every package installed, and we parse your require() statements to create the appropriate links internally.
I like the repl interface, and on the homepage screenshots make it look like it's a native, client-side app. I would I would actually like to have a rich node repl as a native app.
Just take the frontend code and replace the remote backend with electron?
hmm, I wonder if it's possible to require modules in vanilla browser JavaScript ... Both require() and module.export is valid JavaScript, so it should be possible! You just need a service that will redirect a module name to an on-line repository.
Services like browserify essentially do this for you, as long as you are willing to compile ahead of time (and leave a lot of packages that don't "make sense" on the browser behind).
The idea here of course is that all those packages are usable (so for example if you want to show someone how to take files and zip them, you can). Additionally, it is important not to forget that a package can actually be 20 packages thanks to nested dependencies. A lot of work went into making a system that when you type require("package") works instantly and doesn't have to go and fetch the nested dependencies -- not only that, but shrink-wrapping in the background so that rerunning the notebook is 100% reproducible (not constantly changing underneath you as versions change). With this we also get the really cool ability to not only have every package on npm, but every version of every package. If you look at this example, you'll see we can easily compare two versions of the same package: https://tonicdev.com/tonic/api-diff-example
Tested out an idea quickly with Twilio, demoed an API in another notebook, and prototyped a new feature from my iPad while on an airplane (that's my favorite part).
It's been really useful for me and now that I can embed it into my blog posts or in the documentation is going to be really helpful for the rest of our team. Awesome work guys!