forked from NativeScript/NativeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.d.ts
More file actions
197 lines (165 loc) · 7.17 KB
/
application.d.ts
File metadata and controls
197 lines (165 loc) · 7.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/**
* Contains the application abstraction with all related methods.
*/
declare module "application" {
import cssSelector = require("ui/styling/css-selector");
/**
* An extended JavaScript Error which will have the nativeError property initialized in case the error is caused by executing platform-specific code.
*/
export interface NativeScriptError extends Error {
/**
* Represents the native error object.
*/
nativeError: any;
}
/**
* The main page path (without the file extension) for the application starting from the application root.
* For example if you have page called "main.js" in a folder called "subFolder" and your root folder is "app" you can specify mainModule like this:
* var application = require("application");
* application.mainModule = "app/subFolder/main";
* application.start();
*/
export var mainModule: string;
/**
* An application level static resources.
*/
export var resources: any;
/**
* The application level css file name (starting from the application root). Used to set css across all pages.
* Css will be applied for every page and page css will be applied after.
*/
export var cssFile: string;
/**
* Cached css selectors created from the content of the css file.
*/
export var cssSelectorsCache: Array<cssSelector.CssSelector>;
/**
* Loads css file and parses to a css syntax tree.
*/
export function loadCss(): void;
/**
* Call this method to start the application. Important: All code after this method call will not be executed!
*/
export function start();
/**
* The main entry point event. This method is expected to use the root frame to navigate to the main application page.
*/
export function onLaunch(context: any): void;
/**
* A callback to be used when an uncaught error occurs while the application is running.
* The application will be shut down after this method returns.
* Loading new UI at this point is erroneous and may lead to unpredictable results.
* The method is intended to be used for crash reports and/or application restart.
*/
export function onUncaughtError(error: NativeScriptError): void;
/**
* This method will be called when the Application is suspended.
*/
export function onSuspend();
/**
* This method will be called when the Application is resumed after it has been suspended.
*/
export function onResume();
/**
* This method will be called when the Application is about to exit.
*/
export function onExit();
/**
* This method will be called when there is low memory on the target device.
*/
export function onLowMemory();
/**
* This is the Android-specific application object instance.
* Encapsulates methods and properties specific to the Android platform.
* Will be undefined when TargetOS is iOS.
*/
export var android: AndroidApplication;
/**
* This is the iOS-specific application object instance.
* Encapsulates methods and properties specific to the iOS platform.
* Will be undefined when TargetOS is Android.
*/
export var ios: iOSApplication;
/**
* The abstraction of an Android-specific application object.
*/
export interface AndroidApplication {
/**
* The [android Application](http://developer.android.com/reference/android/app/Application.html) object instance provided to the init of the module.
*/
nativeApp: android.app.Application;
/**
* The application's [android Context](http://developer.android.com/reference/android/content/Context.html) object instance.
*/
context: android.content.Context;
/**
* The currently active (loaded) [android Activity](http://developer.android.com/reference/android/app/Activity.html). This property is automatically updated upon Activity events.
*/
foregroundActivity: android.app.Activity;
/**
* The currently active (loaded) Context. This is typically the top-level Activity that is just created.
*/
currentContext: android.content.Context;
/**
* The main (start) Activity for the application.
*/
startActivity: android.app.Activity;
/**
* The name of the application package.
*/
packageName: string;
/**
* This method is called by the JavaScript Bridge when navigation to a new activity is triggered.
* @param intent - Native (android) intent used to create the activity.
* Returns com.tns.NativeScriptActivity.extend implementation.
*/
getActivity(intent: android.content.Intent): any;
/**
* Direct handler of the [onActivityCreated method](http://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks.html).
*/
onActivityCreated: (activity: android.app.Activity, bundle: android.os.Bundle) => void;
/**
* Direct handler of the [onActivityDestroyed method](http://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks.html).
*/
onActivityDestroyed: (activity: android.app.Activity) => void;
/**
* Direct handler of the [onActivityDestroyed method](http://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks.html).
*/
onActivityStarted: (activity: android.app.Activity) => void;
/**
* Direct handler of the [onActivityPaused method](http://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks.html).
*/
onActivityPaused: (activity: android.app.Activity) => void;
/**
* Direct handler of the [onActivityResumed method](http://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks.html).
*/
onActivityResumed: (activity: android.app.Activity) => void;
/**
* Direct handler of the [onActivityStopped method](http://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks.html).
*/
onActivityStopped: (activity: android.app.Activity) => void;
/**
* Direct handler of the [onActivitySaveInstanceState method](http://developer.android.com/reference/android/app/Application.ActivityLifecycleCallbacks.html).
*/
onSaveActivityState: (activity: android.app.Activity, bundle: android.os.Bundle) => void;
/**
* Direct handler of the onActivityResult method.
*/
onActivityResult: (requestCode: number, resultCode: number, data: android.content.Intent) => void
}
/* tslint:disable */
/**
* The abstraction of an iOS-specific application object.
*/
export interface iOSApplication {
/* tslint:enable */
/**
* The root view controller for the application.
*/
rootController: UIViewController;
/**
* The [UIApplication](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html) object instance provided to the init of the module.
*/
nativeApp: UIApplication;
}
}