0.4.5 • Published 8 years ago

pyield v0.4.5

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

#'pyield'

pyield is a node.js package for parallel execution of yield.

Follow me on github!

Usage

npm install pyield

example:

require("babel/polyfill");  // ES6 generator support in Babel
let Promise = require("bluebird")
var co = Promise.coroutine;
var Redis = require('ioredis');
let pyield = require('pyield');

console.log('test runs')

let redis = new Redis({
    port: 6379,          // Redis port
    host: '127.0.0.1'    // Redis host
  });

let parallelAsync = Promise.promisify(pyield.parallel, pyield);

let hco = co(function* () {
  redis.set('a', 'hello a');
  redis.set('b', 'hello b');
  redis.set('c', 'hello c');

  //console.log(yield redis.get('c'));
  let allrel = yield parallelAsync([
     {obj: redis, func: redis.get, param:['a']}
    ,{obj: redis, func: redis.get, param:['b']}
    ,{obj: redis, func: redis.get, param:['c']}]);

  console.log(allrel);
});

hco().then( function() {
         }).catch(function(e){
           console.error(e);
});
0.4.5

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago