Skip to content

Instantly share code, notes, and snippets.

@bozzmob
Created June 15, 2016 08:44
Show Gist options
  • Save bozzmob/2d0108aa447d2bf2da2fb19f6a2c5cb4 to your computer and use it in GitHub Desktop.
Save bozzmob/2d0108aa447d2bf2da2fb19f6a2c5cb4 to your computer and use it in GitHub Desktop.
require("babel-core/register");
require("babel-polyfill");
(async function testingAsyncAwait() {
await console.log("For Trump's Sake Print me!");
})();
@bozzmob
Copy link
Author

bozzmob commented Jun 15, 2016

@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;
})()();

@bozzmob
Copy link
Author

bozzmob commented Jun 15, 2016

@peterlazar1993 Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment