Created
September 15, 2016 23:39
-
-
Save aheckmann/20a7f55022d659038cb4f830ad5f9c71 to your computer and use it in GitHub Desktop.
Revisions
-
aheckmann revised this gist
Sep 15, 2016 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,6 @@ // https://github.com/targos/node/commits/v8-5.4 (https://github.com/nodejs/node/pull/8317) // // node --harmony_async_await await_thenables.js function counter(count) { return { -
aheckmann created this gist
Sep 15, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ 'use strict'; // run using this fork of NodeJS // https://github.com/targos/node/commits/v8-5.4 (https://github.com/nodejs/node/pull/8317) // // node --harmony_async_await await_thenables.js // function counter(count) { return { then: function(res, rej) { const p = Promise.resolve(count++); return p.then(res, rej); } } } ;(async function start() { let incr = counter(1335); console.log(await incr); // 1335 console.log(await incr); // 1336 console.log(await incr); // 1337 })()