dist/amd/aurelia-router.js
function (navigationInstruction, callbackName, next, ignoreResult) {
        var plan = navigationInstruction.plan;
        var infos = findDeactivatable(plan, callbackName);
        var i = infos.length; // query from inside out
        function inspect(val) {
            if (ignoreResult || shouldContinue(val)) {
                return iterate();
            }
            return next.cancel(val);
        }
        function iterate() {
            if (i--) {
                try {
                    var viewModel = infos[i];
                    var result = viewModel[callbackName](navigationInstruction);
                    return processPotential(result, inspect, next.cancel);
                }
                catch (error) {
                    return next.cancel(error);
                }
            }
            navigationInstruction.router.couldDeactivate = true;
            return next();
        }
        return iterate();
    }
function (navigationInstruction, callbackName, next, ignoreResult) {
        var plan = navigationInstruction.plan;
        var infos = findDeactivatable(plan, callbackName);
        var i = infos.length; // query from inside out
        function inspect(val) {
            if (ignoreResult || shouldContinue(val)) {
                return iterate();
            }
            return next.cancel(val);
        }
        function iterate() {
            if (i--) {
                try {
                    var viewModel = infos[i];
                    var result = viewModel[callbackName](navigationInstruction);
                    return processPotential(result, inspect, next.cancel);
                }
                catch (error) {
                    return next.cancel(error);
                }
            }
            navigationInstruction.router.couldDeactivate = true;
            return next();
        }
        return iterate();
    }
function ( navigationInstruction , callbackName , next , ignoreResult ) { var plan = navigationInstruction . plan ; var infos = findDeactivatable ( plan , callbackName ) ; var i = infos . length ; // query from inside out
 function inspect ( val ) { if ( ignoreResult || shouldContinue ( val ) ) { return iterate ( ) ; } return next . cancel ( val ) ; } function iterate ( ) { if ( i -- ) { try { var viewModel = infos [ i ] ; var result = viewModel [ callbackName ] ( navigationInstruction ) ; return processPotential ( result , inspect , next . cancel ) ; } catch ( error ) { return next . cancel ( error ) ; } } navigationInstruction . router . couldDeactivate = true ; return next ( ) ; } return iterate ( ) ; }
Recursively find list of deactivate-able view models
and invoke the either 'canDeactivate' or 'deactivate' on each
@internal exported for unit testing
Recursively find list of deactivate - able view models and invoke the either canDeactivate or deactivate on each