function _iterator(err, res) {

            if (this._interrupt) {
                return this;
            }

            if (!this._alive) {
                throw new Error('this bucks object already destroyed.');
            }

            //taskから渡ってきたresを配列に保持して最後に返す
            res ? this._results.push(res) : this._results.push(null);

            var task  = this._tasks.shift();

            if (!task) { // end of task
                return this.destroy(err);
            }

            try {
                var self = this;
                // handle task
                task(err, res, function (err, res) {
                    self._iterator(err, res);
                    return this;
                }, this._taskcount++);

            } catch (exception) {

                if (!this._results) {
                    // this instance already destroyed.
                    // this exception is uncaught exception.
                    if (Bucks.DEBUG) {
                        // if DEBUG, logging
                        logError(exception);
                    }
                    if (Bucks._isOnError) {
                        Bucks._onError(exception, this);
                    } else {
                        throw exception;
                    }
                }

                // handle error
                this._iterator(exception, null);
            }
            return this;
        }
function _iterator(err, res) {

            if (this._interrupt) {
                return this;
            }

            if (!this._alive) {
                throw new Error('this bucks object already destroyed.');
            }

            
            res ? this._results.push(res) : this._results.push(null);

            var task  = this._tasks.shift();

            if (!task) { 
                return this.destroy(err);
            }

            try {
                var self = this;
                
                task(err, res, function (err, res) {
                    self._iterator(err, res);
                    return this;
                }, this._taskcount++);

            } catch (exception) {

                if (!this._results) {
                    
                    
                    if (Bucks.DEBUG) {
                        
                        logError(exception);
                    }
                    if (Bucks._isOnError) {
                        Bucks._onError(exception, this);
                    } else {
                        throw exception;
                    }
                }

                
                this._iterator(exception, null);
            }
            return this;
        }
function _iterator ( err , res ) { if ( this . _interrupt ) { return this ; } if ( ! this . _alive ) { throw new Error ( 'this bucks object already destroyed.' ) ; } //taskから渡ってきたresを配列に保持して最後に返す res ? this . _results . push ( res ) : this . _results . push ( null ) ; var task = this . _tasks . shift ( ) ; if ( ! task ) { // end of task return this . destroy ( err ) ; } try { var self = this ; // handle task task ( err , res , function ( err , res ) { self . _iterator ( err , res ) ; return this ; } , this . _taskcount ++ ) ; } catch ( exception ) { if ( ! this . _results ) { // this instance already destroyed. // this exception is uncaught exception. if ( Bucks . DEBUG ) { // if DEBUG, logging logError ( exception ) ; } if ( Bucks . _isOnError ) { Bucks . _onError ( exception , this ) ; } else { throw exception ; } } // handle error this . _iterator ( exception , null ) ; } return this ; }
次のタスクを実行します
@memberof Bucks
@instance
@private
@param {Object} err previous error
@param {Object} res previous result
@return {Bucks}
次のタスクを実行します