1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.registerUpdateGlobalState = void 0;
|
4 | var common_1 = require("../common/common");
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | var updateGlobalState = function (trans) {
|
18 | var globals = trans.router.globals;
|
19 | var transitionSuccessful = function () {
|
20 | globals.successfulTransitions.enqueue(trans);
|
21 | globals.$current = trans.$to();
|
22 | globals.current = globals.$current.self;
|
23 | common_1.copy(trans.params(), globals.params);
|
24 | };
|
25 | var clearCurrentTransition = function () {
|
26 |
|
27 | if (globals.transition === trans)
|
28 | globals.transition = null;
|
29 | };
|
30 | trans.onSuccess({}, transitionSuccessful, { priority: 10000 });
|
31 | trans.promise.then(clearCurrentTransition, clearCurrentTransition);
|
32 | };
|
33 | exports.registerUpdateGlobalState = function (transitionService) {
|
34 | return transitionService.onCreate({}, updateGlobalState);
|
35 | };
|
36 |
|
\ | No newline at end of file |