Skip to content

warfrogsdf/asynLoop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asynLoop

asynchronous loop Solution for node Env!!!

Usage

var fs = require('fs');
var AsynLoop = require('../index');

var fileArr = ['./1', './2', './3'];
var iterator = function (index, item, continueCallback, quitCallback) {
    fs.readFile(item, function (err, data) {
        if (err) {
            quitCallback && quitCallback();
        }else{
            console.log('execute loop ' + index + ';');
            continueCallback && continueCallback();
        }
    });
};
var callback = function () {
    console.log('fulfil work.')
};
AsynLoop(fileArr, iterator, callback).start();

Tests

$ cd test
$ node index.js

Credits

License

The MIT License

Copyright (c) 2013 Bean Li

About

asynchronous loop Solution

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published