Skip to content

Instantly share code, notes, and snippets.

@thejmazz
Created February 16, 2016 18:17
Show Gist options
  • Save thejmazz/067295d9fb8b22c77be0 to your computer and use it in GitHub Desktop.
Save thejmazz/067295d9fb8b22c77be0 to your computer and use it in GitHub Desktop.

Revisions

  1. thejmazz created this gist Feb 16, 2016.
    4 changes: 4 additions & 0 deletions .babelrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    {
    "presets": ["es2015"],
    "plugins": ["transform-async-to-generator"]
    }
    10 changes: 10 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    async function foo() {
    console.log('async working!')
    }

    async function bar() {
    await foo()
    console.log('after foo')
    }

    bar()
    18 changes: 18 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    {
    "name": "async-await",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "",
    "license": "MIT",
    "devDependencies": {
    "babel-loader": "^6.2.2",
    "babel-plugin-transform-async-to-generator": "^6.5.0",
    "babel-polyfill": "^6.5.0",
    "babel-preset-es2015": "^6.5.0",
    "webpack": "^1.12.13"
    }
    }
    14 changes: 14 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    module.exports = {
    entry: ['babel-polyfill', './index.js'],
    output: {
    filename: 'bundle.js'
    },
    devtool: 'sourcemap',
    module: {
    loaders: [{
    test: /\.js?$/,
    exclude: /(node_modules)/,
    loader: 'babel'
    }]
    }
    }