whilst.js 409 B

1234567891011121314151617181920
  1. var mod_vasync = require('../lib/vasync');
  2. var n = 0;
  3. var w = mod_vasync.whilst(
  4. function testFunc() {
  5. return (n < 5);
  6. },
  7. function iterateFunc(cb) {
  8. n++;
  9. cb(null, {n: n});
  10. },
  11. function whilstDone(err, arg) {
  12. console.log('err: %j', err);
  13. console.log('arg: %j', arg);
  14. console.log('w (end): %j', w);
  15. }
  16. );
  17. console.log('w (start): %j', w);