Created
June 15, 2016 08:44
-
-
Save bozzmob/2d0108aa447d2bf2da2fb19f6a2c5cb4 to your computer and use it in GitHub Desktop.
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 characters
require("babel-core/register"); | |
require("babel-polyfill"); | |
(async function testingAsyncAwait() { | |
await console.log("For Trump's Sake Print me!"); | |
})(); |
Hey Satvik, for async await you need to have transform-regenerator
and syntax-async-functions
plugin installed and specified in .babelrc
@bharathitman No. True, I was wrong. had to use- Babel preset es2017 plugin
And then did this-
BOZZMOB-M-T0HZ:rest bozzmob$ babel helloz.js --preset > es2017.js
es2017.js-
"use strict";
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { return step("next", value); }, function (err) { return step("throw", err); }); } } return step("next"); }); }; }
require("babel-core/register");
require("babel-polyfill");
(() => {
var ref = _asyncToGenerator(function* () {
yield console.log("For Trump's Sake Print me!");
});
function testingAsyncAwait() {
return ref.apply(this, arguments);
}
return testingAsyncAwait;
})()();
@peterlazar1993 Thanks :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does babel support async await?. It's ES 2017 no?