1 | import { isString } from '../util/util';
|
2 | var OverlayProxy = (function () {
|
3 | |
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function OverlayProxy(_app, _component, _config, _deepLinker) {
|
10 | this._app = _app;
|
11 | this._component = _component;
|
12 | this._config = _config;
|
13 | this._deepLinker = _deepLinker;
|
14 | }
|
15 | |
16 |
|
17 |
|
18 | OverlayProxy.prototype.getImplementation = function () {
|
19 | throw new Error('Child class must implement "getImplementation" method');
|
20 | };
|
21 | |
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | OverlayProxy.prototype.present = function (navOptions) {
|
28 | var _this = this;
|
29 | if (navOptions === void 0) { navOptions = {}; }
|
30 |
|
31 | var isLazyLoaded = isString(this._component);
|
32 | if (isLazyLoaded) {
|
33 | return this._deepLinker.getComponentFromName(this._component).then(function (loadedComponent) {
|
34 | _this._component = loadedComponent;
|
35 | return _this.createAndPresentOverlay(navOptions);
|
36 | });
|
37 | }
|
38 | else {
|
39 | return this.createAndPresentOverlay(navOptions);
|
40 | }
|
41 | };
|
42 | |
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | OverlayProxy.prototype.dismiss = function (data, role, navOptions) {
|
49 | if (this.overlay) {
|
50 | return this.overlay.dismiss(data, role, navOptions);
|
51 | }
|
52 | };
|
53 | |
54 |
|
55 |
|
56 |
|
57 |
|
58 | OverlayProxy.prototype.onDidDismiss = function (callback) {
|
59 | this._onDidDismiss = callback;
|
60 | if (this.overlay) {
|
61 | this.overlay.onDidDismiss(this._onDidDismiss);
|
62 | }
|
63 | };
|
64 | |
65 |
|
66 |
|
67 |
|
68 | OverlayProxy.prototype.createAndPresentOverlay = function (navOptions) {
|
69 | this.overlay = this.getImplementation();
|
70 | this.overlay.onWillDismiss(this._onWillDismiss);
|
71 | this.overlay.onDidDismiss(this._onDidDismiss);
|
72 | return this.overlay.present(navOptions);
|
73 | };
|
74 | |
75 |
|
76 |
|
77 |
|
78 |
|
79 | OverlayProxy.prototype.onWillDismiss = function (callback) {
|
80 | this._onWillDismiss = callback;
|
81 | if (this.overlay) {
|
82 | this.overlay.onWillDismiss(this._onWillDismiss);
|
83 | }
|
84 | };
|
85 | return OverlayProxy;
|
86 | }());
|
87 | export { OverlayProxy };
|
88 | function OverlayProxy_tsickle_Closure_declarations() {
|
89 |
|
90 | OverlayProxy.prototype.overlay;
|
91 |
|
92 | OverlayProxy.prototype._onWillDismiss;
|
93 |
|
94 | OverlayProxy.prototype._onDidDismiss;
|
95 |
|
96 | OverlayProxy.prototype._app;
|
97 |
|
98 | OverlayProxy.prototype._component;
|
99 |
|
100 | OverlayProxy.prototype._config;
|
101 |
|
102 | OverlayProxy.prototype._deepLinker;
|
103 | }
|
104 |
|
\ | No newline at end of file |