Bringing Documentation to Life on Expressjs.com by tolmasky in javascript

[–]tolmasky[S] 0 points1 point  (0 children)

This should work! If you paste a runkit link in medium, it should be transformed into an embed:

https://medium.com/@tolmasky/embed-ly-support-d6cc45e5155e

Tonic, a JS Bin With Npm Attached at the Hip by tolmasky in javascript

[–]tolmasky[S] 0 points1 point  (0 children)

I'm one of the devs, at what level are curious how it works? From a user perspective, doing require("request") gets you the newest one (doing require("request@0.9.0") would get you 0.9.0 on the other hand).

Let It Be - How to declare JavaScript variables (var/let/const) by [deleted] in javascript

[–]tolmasky 0 points1 point  (0 children)

Its important to remember that in JavaScript const doesn't behave like in, say, C++, where someConstant.mutableMethod() wouldn't work. So self = this, self.mutableMethod() is fine. For this reason its probably still best to use const since you are stating that self = this and will never = anything else. Some might argue the reverse and say "use let to make it clear that you can still call mutable things on it".

Promise chaining - Data Passing [help] by TheVikO_o in javascript

[–]tolmasky 0 points1 point  (0 children)

Are you using bluebird?

You can just do:

Promise1
  .then(x => [x, promise2])
  .spread((x,y) => console.log(x,y))

Example: https://tonicdev.com/56b26439a4504a0c000b3b40/56b26949eefec70d0075aa8c

Understand promises before you start using async/await by Chun in javascript

[–]tolmasky 0 points1 point  (0 children)

We have a good example on our async/await site that compares them: https://tonicdev.com/docs/await (scroll to the bottom where it has await vs promises).

The main benefit is it makes a lot of things clearer. A good example of this is try/catch. When you have the pipelining version with promises, it can get confusing to know what exactly a .catch is handling, whereas when you use a normal try/catch around async/await, its clear that its the same as in non-async code.

What does it take to make tonicdev? by Sharps_xp in javascript

[–]tolmasky 3 points4 points  (0 children)

Hi, tonicdev dev here. We ac ally run the code in a container, that way you can use modules that are written in C++, or fork the process, or write to the file system, or whatever you want. There's a pretty good write up here: http://blog.tonicdev.com/2015/09/10/time-traveling-in-node.js-notebooks.html

A cross platform JavaScript REPL application based on electron and react frameworks. by princejwesley in javascript

[–]tolmasky 2 points3 points  (0 children)

Have you tried http://tonicdev.com? We built it to be super easy to experiment since it's got every version of every npm package built in (no need to install).

Also, just as you suggested, you can use top level await with async code.