src/services/state-router.js
function(handler, priority) {
        if(typeof handler !== 'function') {
          throw new Error('Middleware must be a function.');
        }

        if(typeof priority !== 'undefined') handler.priority = priority;
        _layerList.push(handler);
        return _inst;
      }
function(handler, priority) {
        if(typeof handler !== 'function') {
          throw new Error('Middleware must be a function.');
        }

        if(typeof priority !== 'undefined') handler.priority = priority;
        _layerList.push(handler);
        return _inst;
      }
function ( handler , priority ) { if ( typeof handler !== 'function' ) { throw new Error ( 'Middleware must be a function.' ) ; } if ( typeof priority !== 'undefined' ) handler . priority = priority ; _layerList . push ( handler ) ; return _inst ; }
Internal method to add middleware; called during state transition

@param  {Function} handler  A callback, function(request, next)
@param  {Number}   priority A number denoting priority
@return {$state}            Itself; chainable
Internal method to add middleware ; called during state transition