Skip to content

kutlugsahin/async_polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

async_polyfill

es6 async await polyfill

converts function generators into async/await block and returns a Promise

promises should be yielded to syncronize the execution block

installation

npm install --save async_polyfill

usage

var async = require('async_polyfill');

//call generator function without parameters
async(function*(){
  var user = yield fetch('http://example.com/users/1');
  console.log(user);
})();

// call generator functions with parameters
var someUrl = "http://example.com/users/1";

var getUser = function*(url){
  var user = yield fetch(url);
  return user;
}

async(getUser)(someUrl).then(user => console.log(user));

About

es6 async await polyfill

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published