UNPKG

5.34 kBTypeScriptView Raw
1import { EventEmitter } from '@angular/core';
2import { IonicApp } from './app-root';
3import { ClickBlock } from './click-block';
4import { Config } from '../../config/config';
5import { NavOptions } from '../../navigation/nav-util';
6import { MenuController } from './menu-controller';
7import { NavigationContainer } from '../../navigation/navigation-container';
8import { NavControllerBase } from '../../navigation/nav-controller-base';
9import { Platform } from '../../platform/platform';
10import { ViewController } from '../../navigation/view-controller';
11/**
12 * @name App
13 * @description
14 * App is a utility class used in Ionic to get information about various aspects of an app
15 */
16export declare class App {
17 private _config;
18 private _plt;
19 private _menuCtrl;
20 private _disTime;
21 private _scrollTime;
22 private _title;
23 private _titleSrv;
24 private _rootNavs;
25 private _disableScrollAssist;
26 private _didScroll;
27 /**
28 * @hidden
29 */
30 _clickBlock: ClickBlock;
31 /**
32 * @hidden
33 */
34 _appRoot: IonicApp;
35 /**
36 * Observable that emits whenever a view loads in the app.
37 * @returns {Observable} Returns an observable
38 */
39 viewDidLoad: EventEmitter<ViewController>;
40 /**
41 * Observable that emits before any view is entered in the app.
42 * @returns {Observable} Returns an observable
43 */
44 viewWillEnter: EventEmitter<ViewController>;
45 /**
46 * Observable that emits after any view is entered in the app.
47 * @returns {Observable} Returns an observable
48 */
49 viewDidEnter: EventEmitter<ViewController>;
50 /**
51 * Observable that emits before any view is exited in the app.
52 * @returns {Observable} Returns an observable
53 */
54 viewWillLeave: EventEmitter<ViewController>;
55 /**
56 * Observable that emits after any view is exited in the app.
57 * @returns {Observable} Returns an observable
58 */
59 viewDidLeave: EventEmitter<ViewController>;
60 /**
61 * Observable that emits before any view unloads in the app.
62 * @returns {Observable} Returns an observable
63 */
64 viewWillUnload: EventEmitter<ViewController>;
65 constructor(_config: Config, _plt: Platform, _menuCtrl?: MenuController);
66 /**
67 * Sets the document title.
68 * @param {string} val Value to set the document title to.
69 */
70 setTitle(val: string): void;
71 /**
72 * @hidden
73 */
74 setElementClass(className: string, isAdd: boolean): void;
75 /**
76 * @hidden
77 * Sets if the app is currently enabled or not, meaning if it's
78 * available to accept new user commands. For example, this is set to `false`
79 * while views transition, a modal slides up, an action-sheet
80 * slides up, etc. After the transition completes it is set back to `true`.
81 * @param {boolean} isEnabled `true` for enabled, `false` for disabled
82 * @param {number} duration When `isEnabled` is set to `false`, this argument
83 * is used to set the maximum number of milliseconds that app will wait until
84 * it will automatically enable the app again. It's basically a fallback incase
85 * something goes wrong during a transition and the app wasn't re-enabled correctly.
86 */
87 setEnabled(isEnabled: boolean, duration?: number, minDuration?: number): void;
88 /**
89 * @hidden
90 * Toggles whether an application can be scrolled
91 * @param {boolean} disableScroll when set to `false`, the application's
92 * scrolling is enabled. When set to `true`, scrolling is disabled.
93 */
94 _setDisableScroll(disableScroll: boolean): void;
95 /**
96 * @hidden
97 * Boolean if the app is actively enabled or not.
98 * @return {boolean}
99 */
100 isEnabled(): boolean;
101 /**
102 * @hidden
103 */
104 setScrolling(): void;
105 /**
106 * Boolean if the app is actively scrolling or not.
107 * @return {boolean} returns true or false
108 */
109 isScrolling(): boolean;
110 /**
111 * @return {NavController} Returns the first Active Nav Controller from the list. This method is deprecated
112 */
113 getActiveNav(): NavControllerBase;
114 /**
115 * @return {NavController[]} Returns the active NavControllers. Using this method is preferred when we need access to the top-level navigation controller while on the outside views and handlers like `registerBackButtonAction()`
116 */
117 getActiveNavs(rootNavId?: string): NavControllerBase[];
118 getRootNav(): any;
119 getRootNavs(): any[];
120 /**
121 * @return {NavController} Returns the root NavController
122 */
123 getRootNavById(navId: string): NavigationContainer;
124 /**
125 * @hidden
126 */
127 registerRootNav(nav: NavigationContainer): void;
128 /**
129 * @hidden
130 */
131 unregisterRootNav(nav: NavigationContainer): void;
132 getActiveNavContainers(): NavigationContainer[];
133 /**
134 * @hidden
135 */
136 present(enteringView: ViewController, opts: NavOptions, appPortal?: number): Promise<any>;
137 /**
138 * @hidden
139 */
140 goBack(): Promise<any>;
141 /**
142 * @hidden
143 */
144 navPop(): Promise<any>;
145 /**
146 * @hidden
147 */
148 _enableInputBlurring(): void;
149 getNavByIdOrName(id: string): NavigationContainer;
150}
151export declare function getNavByIdOrName(nav: NavigationContainer, id: string): NavigationContainer;
152export declare function findTopNavs(nav: NavigationContainer): NavigationContainer[];