1- /**
2- * The main entry point event. This method is expected to return an instance of the root UI for the application.
3- * This will be an Activity extends for Android and a RootViewController for iOS.
4- */
5- export declare function onLaunch ( ) : any ;
6-
7- /**
8- * This method will be called when the Application is suspended.
9- */
10- export declare function onSuspend ( ) ;
11-
12- /**
13- * This method will be called when the Application is resumed after it has been suspended.
14- */
15- export declare function onResume ( ) ;
16-
17- /**
18- * This method will be called when the Application is about to exit.
19- */
20- export declare function onExit ( ) ;
21-
22- /**
23- * This method will be called when there is low memory on the target device.
24- */
25- export declare function onLowMemory ( ) ;
26-
27- /**
28- * This is the Android-specific application object instance.
29- * Encapsulates methods and properties specific to the Android platform.
30- * Will be undefined when TargetOS is iOS.
31- */
32- export declare var android : AndroidApplication ;
33-
34- /**
35- * This is the iOS-specific application object instance.
36- * Encapsulates methods and properties specific to the iOS platform.
37- * Will be undefined when TargetOS is Android.
38- */
39- export declare var ios : iOSApplication ;
40-
41- /**
42- * The abstraction of an Android-specific application object.
43- */
44- export declare class AndroidApplication {
45- /**
46- * The android.app.Application object instance provided to the init of the module.
47- */
48- public nativeApp : android . app . Application ;
49-
50- /**
51- * The application android.content.Context object instance.
52- */
53- public context : android . content . Context ;
54-
55- /**
56- * The currently active (loaded) android.app.Activity. This property is automatically updated upon Activity events.
57- */
58- public currentActivity : android . app . Activity ;
1+
2+ declare module "application" {
593
604 /**
61- * The main (start) Activity for the application.
5+ * The main entry point event. This method is expected to return an instance of the root UI for the application.
6+ * This will be an Activity extends for Android and a RootViewController for iOS.
627 */
63- public startActivity : android . app . Activity ;
8+ function onLaunch ( ) : any ;
649
6510 /**
66- * The name of the application package .
11+ * This method will be called when the Application is suspended .
6712 */
68- public packageName : string ;
13+ function onSuspend ( ) ;
6914
7015 /**
71- * This method is called by the JavaScript Bridge when navigation to a new activity is triggered.
72- * The return value of this method should be com.tns.NativeScriptActivity.extends implementation.
16+ * This method will be called when the Application is resumed after it has been suspended.
7317 */
74- public getActivity : ( intent : android . content . Intent ) => any ;
18+ function onResume ( ) ;
7519
7620 /**
77- * Direct handler of the android.app. Application.ActivityLifecycleCallbacks.onActivityCreated method .
21+ * This method will be called when the Application is about to exit .
7822 */
79- public onActivityCreated : ( activity : android . app . Activity , bundle : android . os . Bundle ) => void ;
23+ function onExit ( ) ;
8024
8125 /**
82- * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityDestroyed method .
26+ * This method will be called when there is low memory on the target device .
8327 */
84- public onActivityDestroyed : ( activity : android . app . Activity ) => void ;
28+ function onLowMemory ( ) ;
8529
8630 /**
87- * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityDestroyed method.
31+ * This is the Android-specific application object instance.
32+ * Encapsulates methods and properties specific to the Android platform.
33+ * Will be undefined when TargetOS is iOS.
8834 */
89- public onActivityStarted : ( activity : android . app . Activity ) => void ;
35+ var android : AndroidApplication ;
9036
9137 /**
92- * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityPaused method.
38+ * This is the iOS-specific application object instance.
39+ * Encapsulates methods and properties specific to the iOS platform.
40+ * Will be undefined when TargetOS is Android.
9341 */
94- public onActivityPaused : ( activity : android . app . Activity ) => void ;
42+ var ios : iOSApplication ;
9543
9644 /**
97- * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityResumed method .
45+ * The abstraction of an Android-specific application object .
9846 */
99- public onActivityResumed : ( activity : android . app . Activity ) => void ;
47+ class AndroidApplication {
48+ /**
49+ * The android.app.Application object instance provided to the init of the module.
50+ */
51+ public nativeApp : android . app . Application ;
52+
53+ /**
54+ * The application android.content.Context object instance.
55+ */
56+ public context : android . content . Context ;
57+
58+ /**
59+ * The currently active (loaded) android.app.Activity. This property is automatically updated upon Activity events.
60+ */
61+ public currentActivity : android . app . Activity ;
62+
63+ /**
64+ * The main (start) Activity for the application.
65+ */
66+ public startActivity : android . app . Activity ;
67+
68+ /**
69+ * The name of the application package.
70+ */
71+ public packageName : string ;
72+
73+ /**
74+ * This method is called by the JavaScript Bridge when navigation to a new activity is triggered.
75+ * The return value of this method should be com.tns.NativeScriptActivity.extends implementation.
76+ */
77+ public getActivity : ( intent : android . content . Intent ) => any ;
78+
79+ /**
80+ * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityCreated method.
81+ */
82+ public onActivityCreated : ( activity : android . app . Activity , bundle : android . os . Bundle ) => void ;
83+
84+ /**
85+ * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityDestroyed method.
86+ */
87+ public onActivityDestroyed : ( activity : android . app . Activity ) => void ;
88+
89+ /**
90+ * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityDestroyed method.
91+ */
92+ public onActivityStarted : ( activity : android . app . Activity ) => void ;
93+
94+ /**
95+ * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityPaused method.
96+ */
97+ public onActivityPaused : ( activity : android . app . Activity ) => void ;
98+
99+ /**
100+ * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityResumed method.
101+ */
102+ public onActivityResumed : ( activity : android . app . Activity ) => void ;
103+
104+ /**
105+ * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityStopped method.
106+ */
107+ public onActivityStopped : ( activity : android . app . Activity ) => void ;
108+
109+ /**
110+ * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onSaveActivityState method.
111+ */
112+ public onSaveActivityState : ( activity : android . app . Activity , bundle : android . os . Bundle ) => void ;
113+ }
100114
101115 /**
102- * Direct handler of the android.app.Application.ActivityLifecycleCallbacks.onActivityStopped method .
116+ * The abstraction of an iOS-specific application object .
103117 */
104- public onActivityStopped : ( activity : android . app . Activity ) => void ;
118+ class iOSApplication {
119+ /**
120+ * The root view controller for the application.
121+ */
122+ public rootController : UIKit . UIViewController ;
123+
124+ /**
125+ * The android.app.Application object instance provided to the init of the module.
126+ */
127+ public nativeApp : UIKit . UIApplication ;
128+ }
105129
106130 /**
107- * Direct handler of the android.app. Application.ActivityLifecycleCallbacks.onSaveActivityState method .
131+ * Entry point for the module. Initializes the Application singleton and hooks application lifecycle events .
108132 */
109- public onSaveActivityState : ( activity : android . app . Activity , bundle : android . os . Bundle ) => void ;
110- }
111-
112- /**
113- * The abstraction of an iOS-specific application object.
114- */
115- export declare class iOSApplication {
116- /**
117- * The root view controller for the application.
118- */
119- public rootController : UIKit . UIViewController ;
120-
121- /**
122- * The android.app.Application object instance provided to the init of the module.
123- */
124- public nativeApp : UIKit . UIApplication ;
125- }
126-
127- /**
128- * Entry point for the module. Initializes the Application singleton and hooks application lifecycle events.
129- */
130- export declare function init ( nativeApp : any ) ;
133+ function init ( nativeApp : any ) ;
134+ }
0 commit comments