src/services/queue-handler.js
function(callback) {
        var nextHandler;
        var executionList = _list.slice(0).sort(function(a, b) {
          return Math.max(-1, Math.min(1, b.priority - a.priority));
        });

        nextHandler = function() {
          $rootScope.$evalAsync(function() {
            var handler = executionList.shift();

            // Complete
            if(!handler) {
              callback(null);

            // Next handler
            } else {
              handler.call(null, _data, function(err) {
                // Error
                if(err) {
                  callback(err);

                // Continue
                } else {
                  nextHandler();
                }
              });
            }
          });
        };

        // Start
        nextHandler();
      }
function(callback) {
        var nextHandler;
        var executionList = _list.slice(0).sort(function(a, b) {
          return Math.max(-1, Math.min(1, b.priority - a.priority));
        });

        nextHandler = function() {
          $rootScope.$evalAsync(function() {
            var handler = executionList.shift();

            // Complete
            if(!handler) {
              callback(null);

            // Next handler
            } else {
              handler.call(null, _data, function(err) {
                // Error
                if(err) {
                  callback(err);

                // Continue
                } else {
                  nextHandler();
                }
              });
            }
          });
        };

        // Start
        nextHandler();
      }
function ( callback ) { var nextHandler ; var executionList = _list . slice ( 0 ) . sort ( function ( a , b ) { return Math . max ( - 1 , Math . min ( 1 , b . priority - a . priority ) ) ; } ) ; nextHandler = function ( ) { $rootScope . $evalAsync ( function ( ) { var handler = executionList . shift ( ) ; // Complete if ( ! handler ) { callback ( null ) ; // Next handler } else { handler . call ( null , _data , function ( err ) { // Error if ( err ) { callback ( err ) ; // Continue } else { nextHandler ( ) ; } } ) ; } } ) ; } ; // Start nextHandler ( ) ; }
Begin execution and trigger callback at the end

@param  {Function} callback A callback, function(err)
@return {Queue}             Itself; chainable
Begin execution and trigger callback at the end