Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajcrites/e6fd928f1a300bf40cea to your computer and use it in GitHub Desktop.
Save ajcrites/e6fd928f1a300bf40cea to your computer and use it in GitHub Desktop.
require("babel/polyfill");
var assert = require("assert");
async () => {
let start = new Date;
let [valuea, valueb] = await* [
(() => new Promise(resolve => setTimeout(
() => resolve("value a"), 2000
)))(),
(() => new Promise(resolve => setTimeout(
() => resolve("value b"), 2000
)))(),
];
let end = new Date;
assert.equal(valuea, "value a");
assert.equal(valueb, "value b");
assert.equal(~~((end - start) / 1000), 2);
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment