src/basis/router.js
function remove(route, callback, context){
    var route = get({
      path: route
    });

    if (!route)
      return;

    for (var i = 0, cb; cb = route.callbacks_[i]; i++)
    {
      if (cb.cb_ === callback && cb.context === context)
      {
        route.callbacks_.splice(i, 1);

        if (route.value && callback && callback.leave)
        {
          callback.leave.call(context);

          /** @cut */ if (module.exports.debug)
          /** @cut */   basis.dev.info(
          /** @cut */     namespace + ': add handler for route `' + path + '`\n',
          /** @cut */     { type: 'leave', path: route.path, cb: callback.leave, route: route }
          /** @cut */   );
        }

        if (!route.callbacks_.length)
        {
          // check no attaches to route
          if ((!route.handler || !route.handler.handler) && !route.matched.handler)
          {
            basis.array.remove(allRoutes, route);

            if (!(route instanceof ParametrizedRoute))
              delete plainRoutesByPath[route.path];
          }
        }

        return;
      }
    }
    /** @cut */ basis.dev.warn(namespace + ': no callback removed', { callback: callback, context: context });
  }
function remove(route, callback, context){
    var route = get({
      path: route
    });

    if (!route)
      return;

    for (var i = 0, cb; cb = route.callbacks_[i]; i++)
    {
      if (cb.cb_ === callback && cb.context === context)
      {
        route.callbacks_.splice(i, 1);

        if (route.value && callback && callback.leave)
        {
          callback.leave.call(context);

          /** @cut */ if (module.exports.debug)
          /** @cut */   basis.dev.info(
          /** @cut */     namespace + ': add handler for route `' + path + '`\n',
          /** @cut */     { type: 'leave', path: route.path, cb: callback.leave, route: route }
          /** @cut */   );
        }

        if (!route.callbacks_.length)
        {
          // check no attaches to route
          if ((!route.handler || !route.handler.handler) && !route.matched.handler)
          {
            basis.array.remove(allRoutes, route);

            if (!(route instanceof ParametrizedRoute))
              delete plainRoutesByPath[route.path];
          }
        }

        return;
      }
    }
    /** @cut */ basis.dev.warn(namespace + ': no callback removed', { callback: callback, context: context });
  }
function remove ( route , callback , context ) { var route = get ( { path : route } ) ; if ( ! route ) return ; for ( var i = 0 , cb ; cb = route . callbacks_ [ i ] ; i ++ ) { if ( cb . cb_ === callback && cb . context === context ) { route . callbacks_ . splice ( i , 1 ) ; if ( route . value && callback && callback . leave ) { callback . leave . call ( context ) ; /** @cut */ if ( module . exports . debug ) /** @cut */ basis . dev . info ( /** @cut */ namespace + ': add handler for route `' + path + '`\n' , /** @cut */ { type : 'leave' , path : route . path , cb : callback . leave , route : route } /** @cut */ ) ; } if ( ! route . callbacks_ . length ) { // check no attaches to route if ( ( ! route . handler || ! route . handler . handler ) && ! route . matched . handler ) { basis . array . remove ( allRoutes , route ) ; if ( ! ( route instanceof ParametrizedRoute ) ) delete plainRoutesByPath [ route . path ] ; } } return ; } } /** @cut */ basis . dev . warn ( namespace + ': no callback removed' , { callback : callback , context : context } ) ; }
Remove handler for path
Remove handler for path