UNPKG

3.02 kBJavaScriptView Raw
1import { Injectable } from '@angular/core';
2import { Config } from '../config/config';
3import { isPresent } from '../util/util';
4import { Platform } from '../platform/platform';
5/**
6 * @hidden
7 */
8var TransitionController = (function () {
9 /**
10 * @param {?} plt
11 * @param {?} _config
12 */
13 function TransitionController(plt, _config) {
14 this.plt = plt;
15 this._config = _config;
16 this._ids = 0;
17 this._trns = {};
18 }
19 /**
20 * @param {?} nav
21 * @return {?}
22 */
23 TransitionController.prototype.getRootTrnsId = function (nav) {
24 nav = (nav.parent);
25 while (nav) {
26 if (isPresent(nav._trnsId)) {
27 return nav._trnsId;
28 }
29 nav = nav.parent;
30 }
31 return null;
32 };
33 /**
34 * @return {?}
35 */
36 TransitionController.prototype.nextId = function () {
37 return this._ids++;
38 };
39 /**
40 * @param {?} trnsId
41 * @param {?} enteringView
42 * @param {?} leavingView
43 * @param {?} opts
44 * @return {?}
45 */
46 TransitionController.prototype.get = function (trnsId, enteringView, leavingView, opts) {
47 var /** @type {?} */ TransitionClass = this._config.getTransition(opts.animation);
48 if (!TransitionClass) {
49 // didn't find a transition animation, default to ios-transition
50 TransitionClass = this._config.getTransition('ios-transition');
51 }
52 var /** @type {?} */ trns = new TransitionClass(this.plt, enteringView, leavingView, opts);
53 trns.trnsId = trnsId;
54 if (!this._trns[trnsId]) {
55 // we haven't created the root transition yet
56 this._trns[trnsId] = trns;
57 }
58 else {
59 // we already have a root transition created
60 // add this new transition as a child to the root
61 this._trns[trnsId].add(trns);
62 }
63 return trns;
64 };
65 /**
66 * @param {?} trnsId
67 * @return {?}
68 */
69 TransitionController.prototype.destroy = function (trnsId) {
70 var /** @type {?} */ trans = this._trns[trnsId];
71 if (trans) {
72 trans.destroy();
73 delete this._trns[trnsId];
74 }
75 };
76 return TransitionController;
77}());
78export { TransitionController };
79TransitionController.decorators = [
80 { type: Injectable },
81];
82/**
83 * @nocollapse
84 */
85TransitionController.ctorParameters = function () { return [
86 { type: Platform, },
87 { type: Config, },
88]; };
89function TransitionController_tsickle_Closure_declarations() {
90 /** @type {?} */
91 TransitionController.decorators;
92 /**
93 * @nocollapse
94 * @type {?}
95 */
96 TransitionController.ctorParameters;
97 /** @type {?} */
98 TransitionController.prototype._ids;
99 /** @type {?} */
100 TransitionController.prototype._trns;
101 /** @type {?} */
102 TransitionController.prototype.plt;
103 /** @type {?} */
104 TransitionController.prototype._config;
105}
106//# sourceMappingURL=transition-controller.js.map
\No newline at end of file