mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
No more ambient modules for tns-core-modules/* subpackages.
- Use path mappings in tsconfig.json to resolve module typings - Only use ambient mobules for global API's - Move single-file modules to a subdir with the same name so that we can provide a hand-written typing next to it (via package.json) - Delete all mentions of tns-core-modules.d.ts - Delete reference d.ts assembly build steps. Not needed anymore. - HACK! Use a <reference> for global typings in application.d.ts to avoid publishing a separate @types/tns-core-modules package. - Rename declarations.d.ts to tns-core-modules.d.ts to preserve JS project mappings in references.d.ts (the only place we use those)
This commit is contained in:
committed by
Hristo Deshev
parent
1af8c6ca8e
commit
b45cbe929b
@@ -9,7 +9,7 @@ global.moduleMerge(events, exports);
|
||||
|
||||
export { Observable };
|
||||
|
||||
import { NativeScriptError, UnhandledErrorEventData, iOSApplication, AndroidApplication, CssChangedEventData } from "application";
|
||||
import { UnhandledErrorEventData, iOSApplication, AndroidApplication, CssChangedEventData } from "application";
|
||||
import { NavigationEntry } from "ui/frame";
|
||||
|
||||
export const launchEvent = "launch";
|
||||
@@ -58,4 +58,4 @@ export function addCss(cssText: string): void {
|
||||
|
||||
global.__onUncaughtError = function (error: NativeScriptError) {
|
||||
events.notify(<UnhandledErrorEventData>{ eventName: uncaughtErrorEvent, object: app, android: error, ios: error, error: error });
|
||||
}
|
||||
}
|
||||
|
||||
811
tns-core-modules/application/application.d.ts
vendored
811
tns-core-modules/application/application.d.ts
vendored
@@ -1,539 +1,534 @@
|
||||
/**
|
||||
///<reference path="../tns-core-modules.d.ts" /> Include global typings
|
||||
/**
|
||||
* Contains the application abstraction with all related methods.
|
||||
*/
|
||||
declare module "application" {
|
||||
import { NavigationEntry, View, Observable, EventData } from "ui/frame";
|
||||
import { NavigationEntry, View, Observable, EventData } from "ui/frame";
|
||||
|
||||
/**
|
||||
* String value used when hooking to launch event.
|
||||
*/
|
||||
export var launchEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to uncaughtError event.
|
||||
*/
|
||||
export var uncaughtErrorEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to suspend event.
|
||||
*/
|
||||
export var suspendEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to resume event.
|
||||
*/
|
||||
export var resumeEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to exitevent.
|
||||
*/
|
||||
export var exitEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to lowMemory event.
|
||||
*/
|
||||
export var lowMemoryEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to orientationChanged event.
|
||||
*/
|
||||
export var orientationChangedEvent: string;
|
||||
|
||||
/**
|
||||
* Event data containing information for the application events.
|
||||
*/
|
||||
export interface ApplicationEventData extends EventData {
|
||||
/**
|
||||
* Gets the native iOS event arguments. Valid only when running on iOS.
|
||||
*/
|
||||
ios?: any;
|
||||
|
||||
/**
|
||||
* String value used when hooking to launch event.
|
||||
* Gets the native Android event arguments. Valid only when running on Android.
|
||||
*/
|
||||
export const launchEvent: string;
|
||||
android?: any;
|
||||
|
||||
/**
|
||||
* String value used when hooking to uncaughtError event.
|
||||
* The name of the event.
|
||||
*/
|
||||
export const uncaughtErrorEvent: string;
|
||||
eventName: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to suspend event.
|
||||
* The instance that has raised the event.
|
||||
*/
|
||||
export const suspendEvent: string;
|
||||
object: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event data containing information for launch event.
|
||||
*/
|
||||
export interface LaunchEventData extends ApplicationEventData {
|
||||
/**
|
||||
* The root view for this Window on iOS or Activity for Android.
|
||||
* If not set a new Frame will be created as a root view in order to maintain backwards compatibility.
|
||||
*/
|
||||
root?: View;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event data containing information for orientation changed event.
|
||||
*/
|
||||
export interface OrientationChangedEventData extends ApplicationEventData {
|
||||
/**
|
||||
* New orientation value.
|
||||
*/
|
||||
newValue: "portrait" | "landscape" | "unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
* Event data containing information about unhandled application errors.
|
||||
*/
|
||||
export interface UnhandledErrorEventData extends ApplicationEventData {
|
||||
ios?: NativeScriptError;
|
||||
android?: NativeScriptError;
|
||||
error: NativeScriptError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event data containing information about application css change.
|
||||
*/
|
||||
export interface CssChangedEventData extends EventData {
|
||||
cssFile?: string;
|
||||
cssText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* The main navigation entry to be used when loading the main Page.
|
||||
*/
|
||||
export var mainEntry: NavigationEntry;
|
||||
|
||||
/**
|
||||
* An application level static resources.
|
||||
*/
|
||||
export var resources: any;
|
||||
|
||||
/**
|
||||
* Sets application level static resources.
|
||||
*/
|
||||
export function setResources(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;
|
||||
|
||||
/**
|
||||
* Sets css file name for the application.
|
||||
*/
|
||||
export function setCssFileName(cssFile: string): void;
|
||||
|
||||
export function addCss(cssText: string): void;
|
||||
|
||||
/**
|
||||
* This event is raised when application css is changed.
|
||||
*/
|
||||
export function on(event: "cssChanged", callback: (args: CssChangedEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Event raised then livesync operation is performed.
|
||||
*/
|
||||
export function on(event: "livesync", callback: (args: EventData) => void);
|
||||
|
||||
/**
|
||||
* Call this method to start the application. Important: All code after this method call will not be executed!
|
||||
*/
|
||||
export function start(entry?: NavigationEntry);
|
||||
|
||||
/**
|
||||
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
||||
* @param eventNames - String corresponding to events (e.g. "onLaunch"). Optionally could be used more events separated by `,` (e.g. "onLaunch", "onSuspend").
|
||||
* @param callback - Callback function which will be executed when event is raised.
|
||||
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
||||
*/
|
||||
export function on(eventNames: string, callback: (data: any) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Shortcut alias to the removeEventListener method.
|
||||
* @param eventNames - String corresponding to events (e.g. "onLaunch").
|
||||
* @param callback - Callback function which will be removed.
|
||||
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
||||
*/
|
||||
export function off(eventNames: string, callback?: any, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Notifies all the registered listeners for the event provided in the data.eventName.
|
||||
* @param data The data associated with the event.
|
||||
*/
|
||||
export function notify(data: any): void;
|
||||
|
||||
/**
|
||||
* Checks whether a listener is registered for the specified event name.
|
||||
* @param eventName The name of the event to check for.
|
||||
*/
|
||||
export function hasListeners(eventName: string): boolean;
|
||||
|
||||
/**
|
||||
* This event is raised on application launchEvent.
|
||||
*/
|
||||
export function on(event: "launch", callback: (args: LaunchEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the Application is suspended.
|
||||
*/
|
||||
export function on(event: "suspend", callback: (args: ApplicationEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the Application is resumed after it has been suspended.
|
||||
*/
|
||||
export function on(event: "resume", callback: (args: ApplicationEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the Application is about to exitEvent.
|
||||
*/
|
||||
export function on(event: "exit", callback: (args: ApplicationEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when there is low memory on the target device.
|
||||
*/
|
||||
export function on(event: "lowMemory", callback: (args: ApplicationEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when an uncaught error occurs while the application is running.
|
||||
*/
|
||||
export function on(event: "uncaughtError", callback: (args: UnhandledErrorEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised the orientation of the current device has changed.
|
||||
*/
|
||||
export function on(event: "orientationChanged", callback: (args: OrientationChangedEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* 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 let 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 let ios: iOSApplication;
|
||||
|
||||
/**
|
||||
* Data for the Android activity events.
|
||||
*/
|
||||
export interface AndroidActivityEventData {
|
||||
/**
|
||||
* The activity.
|
||||
*/
|
||||
activity: any /* android.app.Activity */;
|
||||
|
||||
/**
|
||||
* String value used when hooking to resume event.
|
||||
* The name of the event.
|
||||
*/
|
||||
export const resumeEvent: string;
|
||||
eventName: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to exitevent.
|
||||
* The instance that has raised the event.
|
||||
*/
|
||||
export const exitEvent: string;
|
||||
object: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data for the Android activity events with bundle.
|
||||
*/
|
||||
export interface AndroidActivityBundleEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* The bundle.
|
||||
*/
|
||||
bundle: any /* android.os.Bundle */;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data for the Android activity onRequestPermissions callback
|
||||
*/
|
||||
export interface AndroidActivityRequestPermissionsEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* The request code.
|
||||
*/
|
||||
requestCode: number,
|
||||
|
||||
/**
|
||||
* String value used when hooking to lowMemory event.
|
||||
* The Permissions
|
||||
*/
|
||||
export const lowMemoryEvent: string;
|
||||
permissions: Array<string>,
|
||||
|
||||
/**
|
||||
* String value used when hooking to orientationChanged event.
|
||||
* The Granted.
|
||||
*/
|
||||
export const orientationChangedEvent: string;
|
||||
grantResults: Array<number>
|
||||
}
|
||||
|
||||
/**
|
||||
* Data for the Android activity result event.
|
||||
*/
|
||||
export interface AndroidActivityResultEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* The request code.
|
||||
*/
|
||||
requestCode: number;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
* The result code.
|
||||
*/
|
||||
export let mainModule: string;
|
||||
resultCode: number;
|
||||
|
||||
/**
|
||||
* The main navigation entry to be used when loading the main Page.
|
||||
* The intent.
|
||||
*/
|
||||
export let mainEntry: NavigationEntry;
|
||||
intent: any /* android.content.Intent */;
|
||||
}
|
||||
|
||||
/**
|
||||
* An application level static resources.
|
||||
*/
|
||||
export let resources: any;
|
||||
/**
|
||||
* Data for the Android activity back pressed event.
|
||||
*/
|
||||
export interface AndroidActivityBackPressedEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* In the event handler, set this value to true if you want to cancel the back navigation and do something else instead.
|
||||
*/
|
||||
cancel: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The abstraction of an Android-specific application object.
|
||||
*/
|
||||
export class AndroidApplication extends Observable {
|
||||
/**
|
||||
* The [android Application](http://developer.android.com/reference/android/app/Application.html) object instance provided to the init of the module.
|
||||
*/
|
||||
nativeApp: any /* android.app.Application */;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* The application's [android Context](http://developer.android.com/reference/android/content/Context.html) object instance.
|
||||
*/
|
||||
export let cssFile: string;
|
||||
context: any /* android.content.Context */;
|
||||
|
||||
/**
|
||||
* Sets application level static resources.
|
||||
* The currently active (loaded) [android Activity](http://developer.android.com/reference/android/app/Activity.html). This property is automatically updated upon Activity events.
|
||||
*/
|
||||
export function setResources(resources: any);
|
||||
foregroundActivity: any /* android.app.Activity */;
|
||||
|
||||
/**
|
||||
* Sets css file name for the application.
|
||||
* [Deprecated. Please use the respective event instead.] Please use foregroundActivity property.
|
||||
*/
|
||||
export function setCssFileName(cssFile: string): void;
|
||||
|
||||
export function addCss(cssText: string): void;
|
||||
currentContext: any /* android.content.Context */;
|
||||
|
||||
/**
|
||||
* Notifies all the registered listeners for the event provided in the data.eventName.
|
||||
* @param data The data associated with the event.
|
||||
* [Deprecated. Please use foregroundActivity or activity related events instead.] The main (start) Activity for the application.
|
||||
*/
|
||||
export function notify(data: any): void;
|
||||
startActivity: any /* android.app.Activity */;
|
||||
|
||||
/**
|
||||
* Call this method to start the application. Important: All code after this method call will not be executed!
|
||||
* The name of the application package.
|
||||
*/
|
||||
export function start(entry?: NavigationEntry);
|
||||
packageName: string;
|
||||
|
||||
/**
|
||||
* True if the main application activity is not running (suspended), false otherwise.
|
||||
*/
|
||||
paused: boolean;
|
||||
|
||||
/**
|
||||
* Initialized the android-specific application object with the native android.app.Application instance.
|
||||
* This is useful when creating custom application types.
|
||||
* @param nativeApp - the android.app.Application instance that started the app.
|
||||
*/
|
||||
init: (nativeApp) => void;
|
||||
|
||||
/**
|
||||
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
||||
* @param eventNames - String corresponding to events (e.g. "onLaunch"). Optionally could be used more events separated by `,` (e.g. "onLaunch", "onSuspend").
|
||||
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
|
||||
* @param callback - Callback function which will be executed when event is raised.
|
||||
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
||||
*/
|
||||
export function on(eventNames: string, callback: (data: any) => void, thisArg?: any);
|
||||
on(eventNames: string, callback: (data: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Shortcut alias to the removeEventListener method.
|
||||
* @param eventNames - String corresponding to events (e.g. "onLaunch").
|
||||
* @param callback - Callback function which will be removed.
|
||||
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
||||
* This event is raised on android application ActivityCreated.
|
||||
*/
|
||||
export function off(eventNames: string, callback?: any, thisArg?: any);
|
||||
on(event: "activityCreated", callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when application css is changed.
|
||||
* This event is raised on android application ActivityDestroyed.
|
||||
*/
|
||||
export function on(event: "cssChanged", callback: (args: CssChangedEventData) => void, thisArg?: any);
|
||||
on(event: "activityDestroyed", callback: (args: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Event raised then livesync operation is performed.
|
||||
* This event is raised on android application ActivityStarted.
|
||||
*/
|
||||
export function on(event: "livesync", callback: (args: EventData) => void);
|
||||
on(event: "activityStarted", callback: (args: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on application launchEvent.
|
||||
* This event is raised on android application ActivityPaused.
|
||||
*/
|
||||
export function on(event: "launch", callback: (args: LaunchEventData) => void, thisArg?: any);
|
||||
on(event: "activityPaused", callback: (args: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the Application is suspended.
|
||||
* This event is raised on android application ActivityResumed.
|
||||
*/
|
||||
export function on(event: "suspend", callback: (args: ApplicationEventData) => void, thisArg?: any);
|
||||
on(event: "activityResumed", callback: (args: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the Application is resumed after it has been suspended.
|
||||
* This event is raised on android application ActivityStopped.
|
||||
*/
|
||||
export function on(event: "resume", callback: (args: ApplicationEventData) => void, thisArg?: any);
|
||||
on(event: "activityStopped", callback: (args: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the Application is about to exitEvent.
|
||||
* This event is raised on android application SaveActivityState.
|
||||
*/
|
||||
export function on(event: "exit", callback: (args: ApplicationEventData) => void, thisArg?: any);
|
||||
on(event: "saveActivityState", callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when there is low memory on the target device.
|
||||
* This event is raised on android application ActivityResult.
|
||||
*/
|
||||
export function on(event: "lowMemory", callback: (args: ApplicationEventData) => void, thisArg?: any);
|
||||
on(event: "activityResult", callback: (args: AndroidActivityResultEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when an uncaught error occurs while the application is running.
|
||||
* This event is raised on the back button is pressed in an android application.
|
||||
*/
|
||||
export function on(event: "uncaughtError", callback: (args: UnhandledErrorEventData) => void, thisArg?: any);
|
||||
on(event: "activityBackPressed", callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised the orientation of the current device has changed.
|
||||
* This event is raised on the back button is pressed in an android application.
|
||||
*/
|
||||
export function on(event: "orientationChanged", callback: (args: OrientationChangedEventData) => void, thisArg?: any);
|
||||
on(event: "activityRequestPermissions", callback: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This is the Android-specific application object instance.
|
||||
* Encapsulates methods and properties specific to the Android platform.
|
||||
* Will be undefined when TargetOS is iOS.
|
||||
* String value used when hooking to activityCreated event.
|
||||
*/
|
||||
export const android: AndroidApplication;
|
||||
public static activityCreatedEvent: string;
|
||||
|
||||
/**
|
||||
* This is the iOS-specific application object instance.
|
||||
* Encapsulates methods and properties specific to the iOS platform.
|
||||
* Will be undefined when TargetOS is Android.
|
||||
* String value used when hooking to activityDestroyed event.
|
||||
*/
|
||||
export const ios: iOSApplication;
|
||||
public static activityDestroyedEvent: string;
|
||||
|
||||
/**
|
||||
* An extended JavaScript Error which will have the nativeError property initialized in case the error is caused by executing platform-specific code.
|
||||
* String value used when hooking to activityStarted event.
|
||||
*/
|
||||
export interface NativeScriptError extends Error {
|
||||
/**
|
||||
* Represents the native error object.
|
||||
*/
|
||||
nativeError: any;
|
||||
}
|
||||
public static activityStartedEvent: string;
|
||||
|
||||
/**
|
||||
* Event data containing information for the application events.
|
||||
* String value used when hooking to activityPaused event.
|
||||
*/
|
||||
export interface ApplicationEventData extends EventData {
|
||||
/**
|
||||
* Gets the native iOS event arguments. Valid only when running on iOS.
|
||||
*/
|
||||
ios?: any;
|
||||
|
||||
/**
|
||||
* Gets the native Android event arguments. Valid only when running on Android.
|
||||
*/
|
||||
android?: any;
|
||||
|
||||
/**
|
||||
* The name of the event.
|
||||
*/
|
||||
eventName: string;
|
||||
|
||||
/**
|
||||
* The instance that has raised the event.
|
||||
*/
|
||||
object: any;
|
||||
}
|
||||
public static activityPausedEvent: string;
|
||||
|
||||
/**
|
||||
* Event data containing information for launch event.
|
||||
* String value used when hooking to activityResumed event.
|
||||
*/
|
||||
export interface LaunchEventData extends ApplicationEventData {
|
||||
/**
|
||||
* The root view for this Window on iOS or Activity for Android.
|
||||
* If not set a new Frame will be created as a root view in order to maintain backwards compatibility.
|
||||
*/
|
||||
root?: View;
|
||||
}
|
||||
public static activityResumedEvent: string;
|
||||
|
||||
/**
|
||||
* Event data containing information for orientation changed event.
|
||||
* String value used when hooking to activityStopped event.
|
||||
*/
|
||||
export interface OrientationChangedEventData extends ApplicationEventData {
|
||||
/**
|
||||
* New orientation value.
|
||||
*/
|
||||
newValue: "portrait" | "landscape" | "unknown";
|
||||
}
|
||||
public static activityStoppedEvent: string;
|
||||
|
||||
/**
|
||||
* Event data containing information about unhandled application errors.
|
||||
* String value used when hooking to saveActivityState event.
|
||||
*/
|
||||
export interface UnhandledErrorEventData extends ApplicationEventData {
|
||||
ios?: NativeScriptError;
|
||||
android?: NativeScriptError;
|
||||
error: NativeScriptError;
|
||||
}
|
||||
public static saveActivityStateEvent: string;
|
||||
|
||||
/**
|
||||
* Event data containing information about application css change.
|
||||
* String value used when hooking to activityResult event.
|
||||
*/
|
||||
export interface CssChangedEventData extends EventData {
|
||||
cssFile?: string;
|
||||
cssText?: string;
|
||||
}
|
||||
public static activityResultEvent: string;
|
||||
|
||||
/**
|
||||
* Data for the Android activity events.
|
||||
* String value used when hooking to activityBackPressed event.
|
||||
*/
|
||||
export interface AndroidActivityEventData {
|
||||
/**
|
||||
* The activity.
|
||||
*/
|
||||
activity: any /* android.app.Activity */;
|
||||
|
||||
/**
|
||||
* The name of the event.
|
||||
*/
|
||||
eventName: string;
|
||||
|
||||
/**
|
||||
* The instance that has raised the event.
|
||||
*/
|
||||
object: any;
|
||||
}
|
||||
public static activityBackPressedEvent: string;
|
||||
|
||||
/**
|
||||
* Data for the Android activity events with bundle.
|
||||
* String value used when hooking to requestPermissions event.
|
||||
*/
|
||||
export interface AndroidActivityBundleEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* The bundle.
|
||||
*/
|
||||
bundle: any /* android.os.Bundle */;
|
||||
}
|
||||
public static activityRequestPermissionsEvent: string;
|
||||
|
||||
/**
|
||||
* Data for the Android activity onRequestPermissions callback
|
||||
* Register a BroadcastReceiver to be run in the main activity thread. The receiver will be called with any broadcast Intent that matches filter, in the main application thread.
|
||||
* For more information, please visit 'http://developer.android.com/reference/android/content/Context.html#registerReceiver%28android.content.BroadcastReceiver,%20android.content.IntentFilter%29'
|
||||
* @param intentFilter A string containing the intent filter.
|
||||
* @param onReceiveCallback A callback function that will be called each time the receiver receives a broadcast.
|
||||
*/
|
||||
export interface AndroidActivityRequestPermissionsEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* The request code.
|
||||
*/
|
||||
requestCode: number,
|
||||
|
||||
/**
|
||||
* The Permissions
|
||||
*/
|
||||
permissions: Array<string>,
|
||||
|
||||
/**
|
||||
* The Granted.
|
||||
*/
|
||||
grantResults: Array<number>
|
||||
}
|
||||
registerBroadcastReceiver(intentFilter: string, onReceiveCallback: (context: any /* android.content.Context */, intent: any /* android.content.Intent */) => void): void;
|
||||
|
||||
/**
|
||||
* Data for the Android activity result event.
|
||||
* Unregister a previously registered BroadcastReceiver.
|
||||
* For more information, please visit 'http://developer.android.com/reference/android/content/Context.html#unregisterReceiver(android.content.BroadcastReceiver)'
|
||||
* @param intentFilter A string containing the intent filter with which the receiver was originally registered.
|
||||
*/
|
||||
export interface AndroidActivityResultEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* The request code.
|
||||
*/
|
||||
requestCode: number;
|
||||
unregisterBroadcastReceiver(intentFilter: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The result code.
|
||||
*/
|
||||
resultCode: number;
|
||||
/* tslint:disable */
|
||||
/**
|
||||
* The abstraction of an iOS-specific application object.
|
||||
*/
|
||||
export interface iOSApplication {
|
||||
/* tslint:enable */
|
||||
/**
|
||||
* The root view controller for the application.
|
||||
*/
|
||||
rootController: any /* UIViewController */;
|
||||
|
||||
/**
|
||||
* The intent.
|
||||
*/
|
||||
intent: any /* android.content.Intent */;
|
||||
}
|
||||
/* tslint:enable */
|
||||
/**
|
||||
* The key window.
|
||||
*/
|
||||
window: any /* UIWindow */;
|
||||
|
||||
/**
|
||||
* Data for the Android activity back pressed event.
|
||||
* The [UIApplication](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html).
|
||||
*/
|
||||
export interface AndroidActivityBackPressedEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* In the event handler, set this value to true if you want to cancel the back navigation and do something else instead.
|
||||
*/
|
||||
cancel: boolean;
|
||||
}
|
||||
nativeApp: any /* UIApplication */;
|
||||
|
||||
/**
|
||||
* The abstraction of an Android-specific application object.
|
||||
* The [UIApplicationDelegate](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html) class.
|
||||
*/
|
||||
export class AndroidApplication extends Observable {
|
||||
/**
|
||||
* The [android Application](http://developer.android.com/reference/android/app/Application.html) object instance provided to the init of the module.
|
||||
*/
|
||||
nativeApp: any /* android.app.Application */;
|
||||
delegate: any /* typeof UIApplicationDelegate */;
|
||||
|
||||
/**
|
||||
* The application's [android Context](http://developer.android.com/reference/android/content/Context.html) object instance.
|
||||
*/
|
||||
context: any /* 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: any /* android.app.Activity */;
|
||||
|
||||
/**
|
||||
* [Deprecated. Please use the respective event instead.] Please use foregroundActivity property.
|
||||
*/
|
||||
currentContext: any /* android.content.Context */;
|
||||
|
||||
/**
|
||||
* [Deprecated. Please use foregroundActivity or activity related events instead.] The main (start) Activity for the application.
|
||||
*/
|
||||
startActivity: any /* android.app.Activity */;
|
||||
|
||||
/**
|
||||
* The name of the application package.
|
||||
*/
|
||||
packageName: string;
|
||||
|
||||
/**
|
||||
* True if the main application activity is not running (suspended), false otherwise.
|
||||
*/
|
||||
paused: boolean;
|
||||
|
||||
/**
|
||||
* Initialized the android-specific application object with the native android.app.Application instance.
|
||||
* This is useful when creating custom application types.
|
||||
* @param nativeApp - the android.app.Application instance that started the app.
|
||||
*/
|
||||
init: (nativeApp) => void;
|
||||
|
||||
/**
|
||||
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
||||
* @param eventNames - String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by `,` (e.g. "propertyChange", "change").
|
||||
* @param callback - Callback function which will be executed when event is raised.
|
||||
* @param thisArg - An optional parameter which will be used as `this` context for callback execution.
|
||||
*/
|
||||
on(eventNames: string, callback: (data: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on android application ActivityCreated.
|
||||
*/
|
||||
on(event: "activityCreated", callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on android application ActivityDestroyed.
|
||||
*/
|
||||
on(event: "activityDestroyed", callback: (args: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on android application ActivityStarted.
|
||||
*/
|
||||
on(event: "activityStarted", callback: (args: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on android application ActivityPaused.
|
||||
*/
|
||||
on(event: "activityPaused", callback: (args: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on android application ActivityResumed.
|
||||
*/
|
||||
on(event: "activityResumed", callback: (args: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on android application ActivityStopped.
|
||||
*/
|
||||
on(event: "activityStopped", callback: (args: AndroidActivityEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on android application SaveActivityState.
|
||||
*/
|
||||
on(event: "saveActivityState", callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on android application ActivityResult.
|
||||
*/
|
||||
on(event: "activityResult", callback: (args: AndroidActivityResultEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on the back button is pressed in an android application.
|
||||
*/
|
||||
on(event: "activityBackPressed", callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised on the back button is pressed in an android application.
|
||||
*/
|
||||
on(event: "activityRequestPermissions", callback: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityCreated event.
|
||||
*/
|
||||
public static activityCreatedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityDestroyed event.
|
||||
*/
|
||||
public static activityDestroyedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityStarted event.
|
||||
*/
|
||||
public static activityStartedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityPaused event.
|
||||
*/
|
||||
public static activityPausedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityResumed event.
|
||||
*/
|
||||
public static activityResumedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityStopped event.
|
||||
*/
|
||||
public static activityStoppedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to saveActivityState event.
|
||||
*/
|
||||
public static saveActivityStateEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityResult event.
|
||||
*/
|
||||
public static activityResultEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityBackPressed event.
|
||||
*/
|
||||
public static activityBackPressedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to requestPermissions event.
|
||||
*/
|
||||
public static activityRequestPermissionsEvent: string;
|
||||
|
||||
/**
|
||||
* Register a BroadcastReceiver to be run in the main activity thread. The receiver will be called with any broadcast Intent that matches filter, in the main application thread.
|
||||
* For more information, please visit 'http://developer.android.com/reference/android/content/Context.html#registerReceiver%28android.content.BroadcastReceiver,%20android.content.IntentFilter%29'
|
||||
* @param intentFilter A string containing the intent filter.
|
||||
* @param onReceiveCallback A callback function that will be called each time the receiver receives a broadcast.
|
||||
*/
|
||||
registerBroadcastReceiver(intentFilter: string, onReceiveCallback: (context: any /* android.content.Context */, intent: any /* android.content.Intent */) => void): void;
|
||||
|
||||
/**
|
||||
* Unregister a previously registered BroadcastReceiver.
|
||||
* For more information, please visit 'http://developer.android.com/reference/android/content/Context.html#unregisterReceiver(android.content.BroadcastReceiver)'
|
||||
* @param intentFilter A string containing the intent filter with which the receiver was originally registered.
|
||||
*/
|
||||
unregisterBroadcastReceiver(intentFilter: string): void;
|
||||
}
|
||||
|
||||
/* tslint:disable */
|
||||
/**
|
||||
* The abstraction of an iOS-specific application object.
|
||||
* Adds an observer to the default notification center for the specified notification.
|
||||
* For more information, please visit 'https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/#//apple_ref/occ/instm/NSNotificationCenter/addObserver:selector:name:object:'
|
||||
* @param notificationName A string containing the name of the notification.
|
||||
* @param onReceiveCallback A callback function that will be called each time the observer receives a notification.
|
||||
*/
|
||||
export interface iOSApplication {
|
||||
/* tslint:enable */
|
||||
/**
|
||||
* The root view controller for the application.
|
||||
*/
|
||||
rootController: any /* UIViewController */;
|
||||
addNotificationObserver(notificationName: string, onReceiveCallback: (notification: any /* NSNotification */) => void): any;
|
||||
|
||||
/* tslint:enable */
|
||||
/**
|
||||
* The key window.
|
||||
*/
|
||||
window: any /* UIWindow */;
|
||||
/**
|
||||
* Removes the observer for the specified notification from the default notification center.
|
||||
* For more information, please visit 'https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/#//apple_ref/occ/instm/NSNotificationCenter/addObserver:selector:name:object:'
|
||||
* @param observer The observer that was returned from the addNotificationObserver method.
|
||||
* @param notificationName A string containing the name of the notification.
|
||||
* @param onReceiveCallback A callback function that will be called each time the observer receives a notification.
|
||||
*/
|
||||
removeNotificationObserver(observer: any, notificationName: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The [UIApplication](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html).
|
||||
*/
|
||||
nativeApp: any /* UIApplication */;
|
||||
/* tslint:disable */
|
||||
export interface RootViewControllerImpl {
|
||||
contentController: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* The [UIApplicationDelegate](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html) class.
|
||||
*/
|
||||
delegate: any /* typeof UIApplicationDelegate */;
|
||||
|
||||
/**
|
||||
* Adds an observer to the default notification center for the specified notification.
|
||||
* For more information, please visit 'https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/#//apple_ref/occ/instm/NSNotificationCenter/addObserver:selector:name:object:'
|
||||
* @param notificationName A string containing the name of the notification.
|
||||
* @param onReceiveCallback A callback function that will be called each time the observer receives a notification.
|
||||
*/
|
||||
addNotificationObserver(notificationName: string, onReceiveCallback: (notification: any /* NSNotification */) => void): any;
|
||||
|
||||
/**
|
||||
* Removes the observer for the specified notification from the default notification center.
|
||||
* For more information, please visit 'https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/#//apple_ref/occ/instm/NSNotificationCenter/addObserver:selector:name:object:'
|
||||
* @param observer The observer that was returned from the addNotificationObserver method.
|
||||
* @param notificationName A string containing the name of the notification.
|
||||
* @param onReceiveCallback A callback function that will be called each time the observer receives a notification.
|
||||
*/
|
||||
removeNotificationObserver(observer: any, notificationName: string): void;
|
||||
}
|
||||
|
||||
/* tslint:disable */
|
||||
export interface RootViewControllerImpl {
|
||||
contentController: any;
|
||||
}
|
||||
|
||||
export function getNativeApplication(): any;
|
||||
}
|
||||
export function getNativeApplication(): any;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"name" : "application",
|
||||
"main" : "application",
|
||||
"nativescript": {}
|
||||
"name" : "application",
|
||||
"main" : "application",
|
||||
"types": "application.d.ts",
|
||||
"nativescript": {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user