public/javascripts/yui/datatable/datatable.js
function () {
        // Grab the first callback in the queue
        var c  = this.q[0],
            fn;

        // If there is no callback in the queue or the Chain is currently
        // in an execution mode, return
        if (!c) {
            this.fireEvent('end');
            return this;
        } else if (this.id) {
            return this;
        }

        fn = c.method || c;

        if (typeof fn === 'function') {
            var o    = c.scope || {},
                args = c.argument || [],
                ms   = c.timeout || 0,
                me   = this;
                
            if (!(args instanceof Array)) {
                args = [args];
            }

            // Execute immediately if the callback timeout is negative.
            if (ms < 0) {
                this.id = ms;
                if (c.until) {
                    for (;!c.until();) {
                        // Execute the callback from scope, with argument
                        fn.apply(o,args);
                    }
                } else if (c.iterations) {
                    for (;c.iterations-- > 0;) {
                        fn.apply(o,args);
                    }
                } else {
                    fn.apply(o,args);
                }
                this.q.shift();
                this.id = 0;
                return this.run();
            } else {
                // If the until condition is set, check if we're done
                if (c.until) {
                    if (c.until()) {
                        // Shift this callback from the queue and execute the next
                        // callback
                        this.q.shift();
                        return this.run();
                    }
                // Otherwise if either iterations is not set or we're
                // executing the last iteration, shift callback from the queue
                } else if (!c.iterations || !--c.iterations) {
                    this.q.shift();
                }

                // Otherwise set to execute after the configured timeout
                this.id = setTimeout(function () {
                    // Execute the callback from scope, with argument
                    fn.apply(o,args);
                    // Check if the Chain was not paused from inside the callback
                    if (me.id) {
                        // Indicate ready to run state
                        me.id = 0;
                        // Start the fun all over again
                        me.run();
                    }
                },ms);
            }
        }

        return this;
    }
function () {
        // Grab the first callback in the queue
        var c  = this.q[0],
            fn;

        // If there is no callback in the queue or the Chain is currently
        // in an execution mode, return
        if (!c) {
            this.fireEvent('end');
            return this;
        } else if (this.id) {
            return this;
        }

        fn = c.method || c;

        if (typeof fn === 'function') {
            var o    = c.scope || {},
                args = c.argument || [],
                ms   = c.timeout || 0,
                me   = this;
                
            if (!(args instanceof Array)) {
                args = [args];
            }

            // Execute immediately if the callback timeout is negative.
            if (ms < 0) {
                this.id = ms;
                if (c.until) {
                    for (;!c.until();) {
                        // Execute the callback from scope, with argument
                        fn.apply(o,args);
                    }
                } else if (c.iterations) {
                    for (;c.iterations-- > 0;) {
                        fn.apply(o,args);
                    }
                } else {
                    fn.apply(o,args);
                }
                this.q.shift();
                this.id = 0;
                return this.run();
            } else {
                // If the until condition is set, check if we're done
                if (c.until) {
                    if (c.until()) {
                        // Shift this callback from the queue and execute the next
                        // callback
                        this.q.shift();
                        return this.run();
                    }
                // Otherwise if either iterations is not set or we're
                // executing the last iteration, shift callback from the queue
                } else if (!c.iterations || !--c.iterations) {
                    this.q.shift();
                }

                // Otherwise set to execute after the configured timeout
                this.id = setTimeout(function () {
                    // Execute the callback from scope, with argument
                    fn.apply(o,args);
                    // Check if the Chain was not paused from inside the callback
                    if (me.id) {
                        // Indicate ready to run state
                        me.id = 0;
                        // Start the fun all over again
                        me.run();
                    }
                },ms);
            }
        }

        return this;
    }
function ( ) { // Grab the first callback in the queue var c = this . q [ 0 ] , fn ; // If there is no callback in the queue or the Chain is currently // in an execution mode, return if ( ! c ) { this . fireEvent ( 'end' ) ; return this ; } else if ( this . id ) { return this ; } fn = c . method || c ; if ( typeof fn === 'function' ) { var o = c . scope || { } , args = c . argument || [ ] , ms = c . timeout || 0 , me = this ; if ( ! ( args instanceof Array ) ) { args = [ args ] ; } // Execute immediately if the callback timeout is negative. if ( ms < 0 ) { this . id = ms ; if ( c . until ) { for ( ; ! c . until ( ) ; ) { // Execute the callback from scope, with argument fn . apply ( o , args ) ; } } else if ( c . iterations ) { for ( ; c . iterations -- > 0 ; ) { fn . apply ( o , args ) ; } } else { fn . apply ( o , args ) ; } this . q . shift ( ) ; this . id = 0 ; return this . run ( ) ; } else { // If the until condition is set, check if we're done if ( c . until ) { if ( c . until ( ) ) { // Shift this callback from the queue and execute the next // callback this . q . shift ( ) ; return this . run ( ) ; } // Otherwise if either iterations is not set or we're // executing the last iteration, shift callback from the queue } else if ( ! c . iterations || ! -- c . iterations ) { this . q . shift ( ) ; } // Otherwise set to execute after the configured timeout this . id = setTimeout ( function ( ) { // Execute the callback from scope, with argument fn . apply ( o , args ) ; // Check if the Chain was not paused from inside the callback if ( me . id ) { // Indicate ready to run state me . id = 0 ; // Start the fun all over again me . run ( ) ; } } , ms ) ; } } return this ; }
Begin executing the chain, or resume execution from the last paused position.
@method run
@return {Chain} the Chain instance
Begin executing the chain or resume execution from the last paused position .