0.3.3 • Published 8 years ago

auto-pilot v0.3.3

Weekly downloads
2
License
Apache License
Repository
github
Last release
8 years ago

auto-pilot

Auto pilot your es6 generator functions

Usage Example

var autopilot = require('auto-pilot');

var joint = function *(input){
    var name = yield httpRequestData(input); //yield a promise 'httpRequestData' resolve ' World!'
    
    var str = yield function(){return 'Hello! ' + name; }; //also can yield a function
    
    return str;       
};

autopilot(joint('An example string')).then(function(str){
    console.log(str) //  'Hello!  World!'
},function(err){
    console.warn(err);
});

Use in angularjs

function customPromiseCreator(func){
	return $q(func);
}
autopilot(joint('Exaple string'),customPromiseCreator);

Notice

Require a global Promise polyfill

Develop/Test

$ npm install $ npm run test

0.3.3

8 years ago

0.3.2

8 years ago

0.3.0

8 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago