UNPKG

709 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.registerInvalidTransitionHook = void 0;
4/**
5 * A [[TransitionHookFn]] that rejects the Transition if it is invalid
6 *
7 * This hook is invoked at the end of the onBefore phase.
8 * If the transition is invalid (for example, param values do not validate)
9 * then the transition is rejected.
10 */
11function invalidTransitionHook(trans) {
12 if (!trans.valid()) {
13 throw new Error(trans.error().toString());
14 }
15}
16exports.registerInvalidTransitionHook = function (transitionService) {
17 return transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 });
18};
19//# sourceMappingURL=invalidTransition.js.map
\No newline at end of file