mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
@@ -1,87 +1,65 @@
|
||||
// Require globals first so that snapshot takes __extends function.
|
||||
import "../globals";
|
||||
import '../globals';
|
||||
|
||||
// Types
|
||||
import { AndroidApplication, iOSApplication } from ".";
|
||||
import {
|
||||
CssChangedEventData,
|
||||
DiscardedErrorEventData,
|
||||
LoadAppCSSEventData,
|
||||
UnhandledErrorEventData,
|
||||
} from "./application-interfaces";
|
||||
import { EventData } from "../data/observable/observable-interfaces";
|
||||
import { View } from "../ui/core/view";
|
||||
import { AndroidApplication, iOSApplication } from '.';
|
||||
import { CssChangedEventData, DiscardedErrorEventData, LoadAppCSSEventData, UnhandledErrorEventData } from './application-interfaces';
|
||||
import { EventData } from '../data/observable';
|
||||
import { View } from '../ui/core/view';
|
||||
|
||||
// Requires
|
||||
import { Observable } from "../data/observable";
|
||||
import {
|
||||
trace as profilingTrace,
|
||||
time,
|
||||
uptime,
|
||||
level as profilingLevel,
|
||||
} from "../profiling";
|
||||
import * as bindableResources from "../ui/core/bindable/bindable-resources";
|
||||
import {
|
||||
CLASS_PREFIX,
|
||||
pushToSystemCssClasses,
|
||||
removeSystemCssClass,
|
||||
} from "../css/system-classes";
|
||||
import { DeviceOrientation, SystemAppearance } from "../ui/enums/enums";
|
||||
import { Observable } from '../data/observable';
|
||||
import { trace as profilingTrace, time, uptime, level as profilingLevel } from '../profiling';
|
||||
import * as bindableResources from '../ui/core/bindable/bindable-resources';
|
||||
import { CLASS_PREFIX, pushToSystemCssClasses, removeSystemCssClass } from '../css/system-classes';
|
||||
import { DeviceOrientation, SystemAppearance } from '../ui/enums';
|
||||
|
||||
export { Observable };
|
||||
export * from "./application-interfaces";
|
||||
export * from './application-interfaces';
|
||||
|
||||
const events = new Observable();
|
||||
let launched = false;
|
||||
function setLaunched() {
|
||||
launched = true;
|
||||
events.off("launch", setLaunched);
|
||||
launched = true;
|
||||
events.off('launch', setLaunched);
|
||||
}
|
||||
events.on("launch", setLaunched);
|
||||
events.on('launch', setLaunched);
|
||||
|
||||
if (profilingLevel() > 0) {
|
||||
events.on("displayed", () => {
|
||||
const duration = uptime();
|
||||
const end = time();
|
||||
const start = end - duration;
|
||||
profilingTrace(`Displayed in ${duration.toFixed(2)}ms`, start, end);
|
||||
});
|
||||
events.on('displayed', () => {
|
||||
const duration = uptime();
|
||||
const end = time();
|
||||
const start = end - duration;
|
||||
profilingTrace(`Displayed in ${duration.toFixed(2)}ms`, start, end);
|
||||
});
|
||||
}
|
||||
|
||||
export function hasLaunched(): boolean {
|
||||
return launched;
|
||||
return launched;
|
||||
}
|
||||
|
||||
export const launchEvent = "launch";
|
||||
export const suspendEvent = "suspend";
|
||||
export const displayedEvent = "displayed";
|
||||
export const resumeEvent = "resume";
|
||||
export const exitEvent = "exit";
|
||||
export const lowMemoryEvent = "lowMemory";
|
||||
export const uncaughtErrorEvent = "uncaughtError";
|
||||
export const discardedErrorEvent = "discardedError";
|
||||
export const orientationChangedEvent = "orientationChanged";
|
||||
export const systemAppearanceChangedEvent = "systemAppearanceChanged";
|
||||
export const launchEvent = 'launch';
|
||||
export const suspendEvent = 'suspend';
|
||||
export const displayedEvent = 'displayed';
|
||||
export const resumeEvent = 'resume';
|
||||
export const exitEvent = 'exit';
|
||||
export const lowMemoryEvent = 'lowMemory';
|
||||
export const uncaughtErrorEvent = 'uncaughtError';
|
||||
export const discardedErrorEvent = 'discardedError';
|
||||
export const orientationChangedEvent = 'orientationChanged';
|
||||
export const systemAppearanceChangedEvent = 'systemAppearanceChanged';
|
||||
|
||||
const ORIENTATION_CSS_CLASSES = [
|
||||
`${CLASS_PREFIX}${DeviceOrientation.portrait}`,
|
||||
`${CLASS_PREFIX}${DeviceOrientation.landscape}`,
|
||||
`${CLASS_PREFIX}${DeviceOrientation.unknown}`,
|
||||
];
|
||||
const ORIENTATION_CSS_CLASSES = [`${CLASS_PREFIX}${DeviceOrientation.portrait}`, `${CLASS_PREFIX}${DeviceOrientation.landscape}`, `${CLASS_PREFIX}${DeviceOrientation.unknown}`];
|
||||
|
||||
const SYSTEM_APPEARANCE_CSS_CLASSES = [
|
||||
`${CLASS_PREFIX}${SystemAppearance.light}`,
|
||||
`${CLASS_PREFIX}${SystemAppearance.dark}`,
|
||||
];
|
||||
const SYSTEM_APPEARANCE_CSS_CLASSES = [`${CLASS_PREFIX}${SystemAppearance.light}`, `${CLASS_PREFIX}${SystemAppearance.dark}`];
|
||||
|
||||
let cssFile: string = "./app.css";
|
||||
let cssFile: string = './app.css';
|
||||
|
||||
export function getResources() {
|
||||
return bindableResources.get();
|
||||
return bindableResources.get();
|
||||
}
|
||||
|
||||
export function setResources(res: any) {
|
||||
bindableResources.set(res);
|
||||
bindableResources.set(res);
|
||||
}
|
||||
|
||||
export let android: AndroidApplication = undefined;
|
||||
@@ -90,164 +68,128 @@ export let ios: iOSApplication = undefined;
|
||||
export const on: typeof events.on = events.on.bind(events);
|
||||
export const off: typeof events.off = events.off.bind(events);
|
||||
export const notify: typeof events.notify = events.notify.bind(events);
|
||||
export const hasListeners: typeof events.hasListeners = events.hasListeners.bind(
|
||||
events
|
||||
);
|
||||
export const hasListeners: typeof events.hasListeners = events.hasListeners.bind(events);
|
||||
|
||||
let app: iOSApplication | AndroidApplication;
|
||||
export function setApplication(
|
||||
instance: iOSApplication | AndroidApplication
|
||||
): void {
|
||||
app = instance;
|
||||
export function setApplication(instance: iOSApplication | AndroidApplication): void {
|
||||
app = instance;
|
||||
}
|
||||
|
||||
export function livesync(rootView: View, context?: ModuleContext) {
|
||||
events.notify(<EventData>{ eventName: "livesync", object: app });
|
||||
const liveSyncCore = global.__onLiveSyncCore;
|
||||
let reapplyAppStyles = false;
|
||||
events.notify(<EventData>{ eventName: 'livesync', object: app });
|
||||
const liveSyncCore = global.__onLiveSyncCore;
|
||||
let reapplyAppStyles = false;
|
||||
|
||||
// ModuleContext is available only for Hot Module Replacement
|
||||
if (context && context.path) {
|
||||
const styleExtensions = ["css", "scss"];
|
||||
const appStylesFullFileName = getCssFileName();
|
||||
const appStylesFileName = appStylesFullFileName.substring(
|
||||
0,
|
||||
appStylesFullFileName.lastIndexOf(".") + 1
|
||||
);
|
||||
reapplyAppStyles = styleExtensions.some(
|
||||
(ext) => context.path === appStylesFileName.concat(ext)
|
||||
);
|
||||
}
|
||||
// ModuleContext is available only for Hot Module Replacement
|
||||
if (context && context.path) {
|
||||
const styleExtensions = ['css', 'scss'];
|
||||
const appStylesFullFileName = getCssFileName();
|
||||
const appStylesFileName = appStylesFullFileName.substring(0, appStylesFullFileName.lastIndexOf('.') + 1);
|
||||
reapplyAppStyles = styleExtensions.some((ext) => context.path === appStylesFileName.concat(ext));
|
||||
}
|
||||
|
||||
// Handle application styles
|
||||
if (rootView && reapplyAppStyles) {
|
||||
rootView._onCssStateChange();
|
||||
} else if (liveSyncCore) {
|
||||
liveSyncCore(context);
|
||||
}
|
||||
// Handle application styles
|
||||
if (rootView && reapplyAppStyles) {
|
||||
rootView._onCssStateChange();
|
||||
} else if (liveSyncCore) {
|
||||
liveSyncCore(context);
|
||||
}
|
||||
}
|
||||
|
||||
export function setCssFileName(cssFileName: string) {
|
||||
cssFile = cssFileName;
|
||||
events.notify(<CssChangedEventData>{
|
||||
eventName: "cssChanged",
|
||||
object: app,
|
||||
cssFile: cssFileName,
|
||||
});
|
||||
cssFile = cssFileName;
|
||||
events.notify(<CssChangedEventData>{
|
||||
eventName: 'cssChanged',
|
||||
object: app,
|
||||
cssFile: cssFileName,
|
||||
});
|
||||
}
|
||||
|
||||
export function getCssFileName(): string {
|
||||
return cssFile;
|
||||
return cssFile;
|
||||
}
|
||||
|
||||
export function loadAppCss(): void {
|
||||
try {
|
||||
events.notify(<LoadAppCSSEventData>{
|
||||
eventName: "loadAppCss",
|
||||
object: app,
|
||||
cssFile: getCssFileName(),
|
||||
});
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`The app CSS file ${getCssFileName()} couldn't be loaded!`
|
||||
);
|
||||
}
|
||||
try {
|
||||
events.notify(<LoadAppCSSEventData>{
|
||||
eventName: 'loadAppCss',
|
||||
object: app,
|
||||
cssFile: getCssFileName(),
|
||||
});
|
||||
} catch (e) {
|
||||
throw new Error(`The app CSS file ${getCssFileName()} couldn't be loaded!`);
|
||||
}
|
||||
}
|
||||
|
||||
function addCssClass(rootView: View, cssClass: string) {
|
||||
pushToSystemCssClasses(cssClass);
|
||||
rootView.cssClasses.add(cssClass);
|
||||
pushToSystemCssClasses(cssClass);
|
||||
rootView.cssClasses.add(cssClass);
|
||||
}
|
||||
|
||||
function removeCssClass(rootView: View, cssClass: string) {
|
||||
removeSystemCssClass(cssClass);
|
||||
rootView.cssClasses.delete(cssClass);
|
||||
removeSystemCssClass(cssClass);
|
||||
rootView.cssClasses.delete(cssClass);
|
||||
}
|
||||
|
||||
function increaseStyleScopeApplicationCssSelectorVersion(rootView: View) {
|
||||
const styleScope =
|
||||
rootView._styleScope ||
|
||||
((<any>rootView).currentPage &&
|
||||
(<any>rootView).currentPage._styleScope);
|
||||
const styleScope = rootView._styleScope || ((<any>rootView).currentPage && (<any>rootView).currentPage._styleScope);
|
||||
|
||||
if (styleScope) {
|
||||
styleScope._increaseApplicationCssSelectorVersion();
|
||||
}
|
||||
if (styleScope) {
|
||||
styleScope._increaseApplicationCssSelectorVersion();
|
||||
}
|
||||
}
|
||||
|
||||
function applyCssClass(
|
||||
rootView: View,
|
||||
cssClasses: string[],
|
||||
newCssClass: string
|
||||
) {
|
||||
if (!rootView.cssClasses.has(newCssClass)) {
|
||||
cssClasses.forEach((cssClass) => removeCssClass(rootView, cssClass));
|
||||
addCssClass(rootView, newCssClass);
|
||||
increaseStyleScopeApplicationCssSelectorVersion(rootView);
|
||||
rootView._onCssStateChange();
|
||||
}
|
||||
function applyCssClass(rootView: View, cssClasses: string[], newCssClass: string) {
|
||||
if (!rootView.cssClasses.has(newCssClass)) {
|
||||
cssClasses.forEach((cssClass) => removeCssClass(rootView, cssClass));
|
||||
addCssClass(rootView, newCssClass);
|
||||
increaseStyleScopeApplicationCssSelectorVersion(rootView);
|
||||
rootView._onCssStateChange();
|
||||
}
|
||||
}
|
||||
|
||||
export function orientationChanged(
|
||||
rootView: View,
|
||||
newOrientation: "portrait" | "landscape" | "unknown"
|
||||
): void {
|
||||
if (!rootView) {
|
||||
return;
|
||||
}
|
||||
export function orientationChanged(rootView: View, newOrientation: 'portrait' | 'landscape' | 'unknown'): void {
|
||||
if (!rootView) {
|
||||
return;
|
||||
}
|
||||
|
||||
const newOrientationCssClass = `${CLASS_PREFIX}${newOrientation}`;
|
||||
applyCssClass(rootView, ORIENTATION_CSS_CLASSES, newOrientationCssClass);
|
||||
const newOrientationCssClass = `${CLASS_PREFIX}${newOrientation}`;
|
||||
applyCssClass(rootView, ORIENTATION_CSS_CLASSES, newOrientationCssClass);
|
||||
|
||||
const rootModalViews = <Array<View>>rootView._getRootModalViews();
|
||||
rootModalViews.forEach((rootModalView) => {
|
||||
applyCssClass(
|
||||
rootModalView,
|
||||
ORIENTATION_CSS_CLASSES,
|
||||
newOrientationCssClass
|
||||
);
|
||||
});
|
||||
const rootModalViews = <Array<View>>rootView._getRootModalViews();
|
||||
rootModalViews.forEach((rootModalView) => {
|
||||
applyCssClass(rootModalView, ORIENTATION_CSS_CLASSES, newOrientationCssClass);
|
||||
});
|
||||
}
|
||||
|
||||
export function systemAppearanceChanged(
|
||||
rootView: View,
|
||||
newSystemAppearance: "dark" | "light"
|
||||
): void {
|
||||
if (!rootView) {
|
||||
return;
|
||||
}
|
||||
export function systemAppearanceChanged(rootView: View, newSystemAppearance: 'dark' | 'light'): void {
|
||||
if (!rootView) {
|
||||
return;
|
||||
}
|
||||
|
||||
const newSystemAppearanceCssClass = `${CLASS_PREFIX}${newSystemAppearance}`;
|
||||
applyCssClass(
|
||||
rootView,
|
||||
SYSTEM_APPEARANCE_CSS_CLASSES,
|
||||
newSystemAppearanceCssClass
|
||||
);
|
||||
const newSystemAppearanceCssClass = `${CLASS_PREFIX}${newSystemAppearance}`;
|
||||
applyCssClass(rootView, SYSTEM_APPEARANCE_CSS_CLASSES, newSystemAppearanceCssClass);
|
||||
|
||||
const rootModalViews = <Array<View>>rootView._getRootModalViews();
|
||||
rootModalViews.forEach((rootModalView) => {
|
||||
applyCssClass(
|
||||
rootModalView,
|
||||
SYSTEM_APPEARANCE_CSS_CLASSES,
|
||||
newSystemAppearanceCssClass
|
||||
);
|
||||
});
|
||||
const rootModalViews = <Array<View>>rootView._getRootModalViews();
|
||||
rootModalViews.forEach((rootModalView) => {
|
||||
applyCssClass(rootModalView, SYSTEM_APPEARANCE_CSS_CLASSES, newSystemAppearanceCssClass);
|
||||
});
|
||||
}
|
||||
|
||||
global.__onUncaughtError = function (error: NativeScriptError) {
|
||||
events.notify(<UnhandledErrorEventData>{
|
||||
eventName: uncaughtErrorEvent,
|
||||
object: app,
|
||||
android: error,
|
||||
ios: error,
|
||||
error: error,
|
||||
});
|
||||
events.notify(<UnhandledErrorEventData>{
|
||||
eventName: uncaughtErrorEvent,
|
||||
object: app,
|
||||
android: error,
|
||||
ios: error,
|
||||
error: error,
|
||||
});
|
||||
};
|
||||
|
||||
global.__onDiscardedError = function (error: NativeScriptError) {
|
||||
events.notify(<DiscardedErrorEventData>{
|
||||
eventName: discardedErrorEvent,
|
||||
object: app,
|
||||
error: error,
|
||||
});
|
||||
events.notify(<DiscardedErrorEventData>{
|
||||
eventName: discardedErrorEvent,
|
||||
object: app,
|
||||
error: error,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,84 +1,89 @@
|
||||
// Types
|
||||
import { EventData } from "../data/observable/observable-interfaces";
|
||||
import { View } from "../ui/core/view";
|
||||
import { EventData } from '../data/observable';
|
||||
import { View } from '../ui/core/view';
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
export interface ApplicationEventData extends EventData {
|
||||
ios?: any;
|
||||
android?: any;
|
||||
eventName: string;
|
||||
object: any;
|
||||
ios?: any;
|
||||
android?: any;
|
||||
eventName: string;
|
||||
object: any;
|
||||
}
|
||||
|
||||
export interface LaunchEventData extends ApplicationEventData {
|
||||
root?: View;
|
||||
savedInstanceState?: any /* android.os.Bundle */;
|
||||
root?: View;
|
||||
savedInstanceState?: any /* android.os.Bundle */;
|
||||
}
|
||||
|
||||
export interface OrientationChangedEventData extends ApplicationEventData {
|
||||
newValue: "portrait" | "landscape" | "unknown";
|
||||
newValue: 'portrait' | 'landscape' | 'unknown';
|
||||
}
|
||||
|
||||
export interface SystemAppearanceChangedEventData extends ApplicationEventData {
|
||||
newValue: "light" | "dark";
|
||||
newValue: 'light' | 'dark';
|
||||
}
|
||||
|
||||
export interface UnhandledErrorEventData extends ApplicationEventData {
|
||||
ios?: NativeScriptError;
|
||||
android?: NativeScriptError;
|
||||
error: NativeScriptError;
|
||||
ios?: NativeScriptError;
|
||||
android?: NativeScriptError;
|
||||
error: NativeScriptError;
|
||||
}
|
||||
|
||||
export interface DiscardedErrorEventData extends ApplicationEventData {
|
||||
error: NativeScriptError;
|
||||
error: NativeScriptError;
|
||||
}
|
||||
|
||||
export interface CssChangedEventData extends EventData {
|
||||
cssFile?: string;
|
||||
cssText?: string;
|
||||
cssFile?: string;
|
||||
cssText?: string;
|
||||
}
|
||||
|
||||
export interface AndroidActivityEventData {
|
||||
activity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
eventName: string;
|
||||
object: any;
|
||||
activity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
eventName: string;
|
||||
object: any;
|
||||
}
|
||||
|
||||
export interface AndroidActivityBundleEventData
|
||||
extends AndroidActivityEventData {
|
||||
bundle: any /* android.os.Bundle */;
|
||||
export interface AndroidActivityBundleEventData extends AndroidActivityEventData {
|
||||
bundle: any /* android.os.Bundle */;
|
||||
}
|
||||
|
||||
export interface AndroidActivityRequestPermissionsEventData
|
||||
extends AndroidActivityEventData {
|
||||
requestCode: number;
|
||||
permissions: Array<string>;
|
||||
grantResults: Array<number>;
|
||||
export interface AndroidActivityRequestPermissionsEventData extends AndroidActivityEventData {
|
||||
requestCode: number;
|
||||
permissions: Array<string>;
|
||||
grantResults: Array<number>;
|
||||
}
|
||||
|
||||
export interface AndroidActivityResultEventData
|
||||
extends AndroidActivityEventData {
|
||||
requestCode: number;
|
||||
resultCode: number;
|
||||
intent: any /* android.content.Intent */;
|
||||
export interface AndroidActivityResultEventData extends AndroidActivityEventData {
|
||||
requestCode: number;
|
||||
resultCode: number;
|
||||
intent: any /* android.content.Intent */;
|
||||
}
|
||||
|
||||
export interface AndroidActivityNewIntentEventData
|
||||
extends AndroidActivityEventData {
|
||||
intent: any /* android.content.Intent */;
|
||||
export interface AndroidActivityNewIntentEventData extends AndroidActivityEventData {
|
||||
intent: any /* android.content.Intent */;
|
||||
}
|
||||
|
||||
export interface AndroidActivityBackPressedEventData
|
||||
extends AndroidActivityEventData {
|
||||
cancel: boolean;
|
||||
export interface AndroidActivityBackPressedEventData extends AndroidActivityEventData {
|
||||
cancel: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export interface RootViewControllerImpl {
|
||||
contentController: any;
|
||||
contentController: any;
|
||||
}
|
||||
|
||||
export interface LoadAppCSSEventData extends EventData {
|
||||
cssFile: string;
|
||||
cssFile: string;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
714
nativescript-core/application/index.d.ts
vendored
714
nativescript-core/application/index.d.ts
vendored
@@ -1,6 +1,8 @@
|
||||
import { NavigationEntry } from "../ui/frame";
|
||||
import { View } from "../ui/core/view";
|
||||
import { Observable, EventData } from "../data/observable";
|
||||
import { NavigationEntry } from '../ui/frame';
|
||||
import { View } from '../ui/core/view';
|
||||
import { Observable, EventData } from '../data/observable';
|
||||
|
||||
export * from './application-interfaces';
|
||||
|
||||
/**
|
||||
* String value used when hooking to launch event.
|
||||
@@ -56,82 +58,82 @@ export const systemAppearanceChangedEvent: 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;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Gets the native Android event arguments. Valid only when running on Android.
|
||||
*/
|
||||
android?: any;
|
||||
|
||||
/**
|
||||
* The name of the event.
|
||||
*/
|
||||
eventName: string;
|
||||
/**
|
||||
* The name of the event.
|
||||
*/
|
||||
eventName: string;
|
||||
|
||||
/**
|
||||
* The instance that has raised the event.
|
||||
*/
|
||||
object: any;
|
||||
/**
|
||||
* The instance that has raised the event.
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* 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;
|
||||
|
||||
savedInstanceState?: any /* android.os.Bundle */;
|
||||
savedInstanceState?: any /* android.os.Bundle */;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event data containing information for orientation changed event.
|
||||
*/
|
||||
export interface OrientationChangedEventData extends ApplicationEventData {
|
||||
/**
|
||||
* New orientation value.
|
||||
*/
|
||||
newValue: "portrait" | "landscape" | "unknown";
|
||||
/**
|
||||
* New orientation value.
|
||||
*/
|
||||
newValue: 'portrait' | 'landscape' | 'unknown';
|
||||
}
|
||||
|
||||
/**
|
||||
* Event data containing information for system appearance changed event.
|
||||
*/
|
||||
export interface SystemAppearanceChangedEventData extends ApplicationEventData {
|
||||
/**
|
||||
* New system appearance value.
|
||||
*/
|
||||
newValue: "light" | "dark";
|
||||
/**
|
||||
* New system appearance value.
|
||||
*/
|
||||
newValue: 'light' | 'dark';
|
||||
}
|
||||
|
||||
/**
|
||||
* Event data containing information about unhandled application errors.
|
||||
*/
|
||||
export interface UnhandledErrorEventData extends ApplicationEventData {
|
||||
ios?: NativeScriptError;
|
||||
android?: NativeScriptError;
|
||||
error: NativeScriptError;
|
||||
ios?: NativeScriptError;
|
||||
android?: NativeScriptError;
|
||||
error: NativeScriptError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event data containing information about discarded application errors.
|
||||
*/
|
||||
export interface DiscardedErrorEventData extends ApplicationEventData {
|
||||
error: NativeScriptError;
|
||||
error: NativeScriptError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event data containing information about application css change.
|
||||
*/
|
||||
export interface CssChangedEventData extends EventData {
|
||||
cssFile?: string;
|
||||
cssText?: string;
|
||||
cssFile?: string;
|
||||
cssText?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,16 +184,12 @@ export function addCss(cssText: string, attributeScoped?: boolean): void;
|
||||
/**
|
||||
* This event is raised when application css is changed.
|
||||
*/
|
||||
export function on(
|
||||
event: "cssChanged",
|
||||
callback: (args: CssChangedEventData) => void,
|
||||
thisArg?: any
|
||||
);
|
||||
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);
|
||||
export function on(event: 'livesync', callback: (args: EventData) => void);
|
||||
|
||||
/**
|
||||
* Removes listener for the specified event name.
|
||||
@@ -216,11 +214,7 @@ export function _resetRootView(entry?: NavigationEntry | string);
|
||||
* @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
|
||||
);
|
||||
export function on(eventNames: string, callback: (data: any) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Shortcut alias to the removeEventListener method.
|
||||
@@ -245,109 +239,69 @@ export function hasListeners(eventName: string): boolean;
|
||||
/**
|
||||
* This event is raised on application launchEvent.
|
||||
*/
|
||||
export function on(
|
||||
event: "launch",
|
||||
callback: (args: LaunchEventData) => void,
|
||||
thisArg?: any
|
||||
);
|
||||
export function on(event: 'launch', callback: (args: LaunchEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised after the application has performed most of its startup actions.
|
||||
* Its intent is to be suitable for measuring app startup times.
|
||||
* @experimental
|
||||
*/
|
||||
export function on(
|
||||
event: "displayed",
|
||||
callback: (args: EventData) => void,
|
||||
thisArg?: any
|
||||
);
|
||||
export function on(event: 'displayed', callback: (args: EventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the Application is suspended.
|
||||
*/
|
||||
export function on(
|
||||
event: "suspend",
|
||||
callback: (args: ApplicationEventData) => void,
|
||||
thisArg?: any
|
||||
);
|
||||
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
|
||||
);
|
||||
export function on(event: 'resume', callback: (args: ApplicationEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the Application is about to exit.
|
||||
*/
|
||||
export function on(
|
||||
event: "exit",
|
||||
callback: (args: ApplicationEventData) => void,
|
||||
thisArg?: any
|
||||
);
|
||||
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
|
||||
);
|
||||
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
|
||||
);
|
||||
export function on(event: 'uncaughtError', callback: (args: UnhandledErrorEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when an discarded error occurs while the application is running.
|
||||
*/
|
||||
export function on(
|
||||
event: "discardedError",
|
||||
callback: (args: DiscardedErrorEventData) => void,
|
||||
thisArg?: any
|
||||
);
|
||||
export function on(event: 'discardedError', callback: (args: DiscardedErrorEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the orientation of the application changes.
|
||||
*/
|
||||
export function on(
|
||||
event: "orientationChanged",
|
||||
callback: (args: OrientationChangedEventData) => void,
|
||||
thisArg?: any
|
||||
);
|
||||
export function on(event: 'orientationChanged', callback: (args: OrientationChangedEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the operating system appearance changes
|
||||
* between light and dark theme (for Android);
|
||||
* between light and dark mode (for iOS) and vice versa.
|
||||
*/
|
||||
export function on(
|
||||
event: "systemAppearanceChanged",
|
||||
callback: (args: SystemAppearanceChangedEventData) => void,
|
||||
thisArg?: any
|
||||
);
|
||||
export function on(event: 'systemAppearanceChanged', callback: (args: SystemAppearanceChangedEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* Gets the orientation of the application.
|
||||
* Available values: "portrait", "landscape", "unknown".
|
||||
*/
|
||||
export function orientation(): "portrait" | "landscape" | "unknown";
|
||||
export function orientation(): 'portrait' | 'landscape' | 'unknown';
|
||||
|
||||
/**
|
||||
* Gets the operating system appearance.
|
||||
* Available values: "dark", "light", null.
|
||||
* Null for iOS <= 11.
|
||||
*/
|
||||
export function systemAppearance(): "dark" | "light" | null;
|
||||
export function systemAppearance(): 'dark' | 'light' | null;
|
||||
|
||||
/**
|
||||
* This is the Android-specific application object instance.
|
||||
@@ -367,336 +321,277 @@ export let ios: iOSApplication;
|
||||
* Data for the Android activity events.
|
||||
*/
|
||||
export interface AndroidActivityEventData {
|
||||
/**
|
||||
* The activity.
|
||||
*/
|
||||
activity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
/**
|
||||
* The activity.
|
||||
*/
|
||||
activity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
|
||||
/**
|
||||
* The name of the event.
|
||||
*/
|
||||
eventName: string;
|
||||
/**
|
||||
* The name of the event.
|
||||
*/
|
||||
eventName: string;
|
||||
|
||||
/**
|
||||
* The instance that has raised the event.
|
||||
*/
|
||||
object: any;
|
||||
/**
|
||||
* The instance that has raised the event.
|
||||
*/
|
||||
object: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data for the Android activity events with bundle.
|
||||
*/
|
||||
export interface AndroidActivityBundleEventData
|
||||
extends AndroidActivityEventData {
|
||||
/**
|
||||
* The bundle.
|
||||
*/
|
||||
bundle: any /* android.os.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;
|
||||
export interface AndroidActivityRequestPermissionsEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* The request code.
|
||||
*/
|
||||
requestCode: number;
|
||||
|
||||
/**
|
||||
* The Permissions.
|
||||
*/
|
||||
permissions: Array<string>;
|
||||
/**
|
||||
* The Permissions.
|
||||
*/
|
||||
permissions: Array<string>;
|
||||
|
||||
/**
|
||||
* The Granted.
|
||||
*/
|
||||
grantResults: Array<number>;
|
||||
/**
|
||||
* The Granted.
|
||||
*/
|
||||
grantResults: Array<number>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data for the Android activity result event.
|
||||
*/
|
||||
export interface AndroidActivityResultEventData
|
||||
extends AndroidActivityEventData {
|
||||
/**
|
||||
* The request code.
|
||||
*/
|
||||
requestCode: number;
|
||||
export interface AndroidActivityResultEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* The request code.
|
||||
*/
|
||||
requestCode: number;
|
||||
|
||||
/**
|
||||
* The result code.
|
||||
*/
|
||||
resultCode: number;
|
||||
/**
|
||||
* The result code.
|
||||
*/
|
||||
resultCode: number;
|
||||
|
||||
/**
|
||||
* The intent.
|
||||
*/
|
||||
intent: any /* android.content.Intent */;
|
||||
/**
|
||||
* The intent.
|
||||
*/
|
||||
intent: any /* android.content.Intent */;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data for the Android activity newIntent event.
|
||||
*/
|
||||
export interface AndroidActivityNewIntentEventData
|
||||
extends AndroidActivityEventData {
|
||||
/**
|
||||
* The intent.
|
||||
*/
|
||||
intent: any /* android.content.Intent */;
|
||||
export interface AndroidActivityNewIntentEventData extends AndroidActivityEventData {
|
||||
/**
|
||||
* The intent.
|
||||
*/
|
||||
intent: any /* android.content.Intent */;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
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 [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's [android Context](http://developer.android.com/reference/android/content/Context.html) object instance.
|
||||
*/
|
||||
context: any /* android.content.Context */;
|
||||
/**
|
||||
* 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 /* androidx.appcompat.app.AppCompatActivity */;
|
||||
/**
|
||||
* 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 /* androidx.appcompat.app.AppCompatActivity */;
|
||||
|
||||
/**
|
||||
* The main (start) Activity for the application.
|
||||
*/
|
||||
startActivity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
/**
|
||||
* The main (start) Activity for the application.
|
||||
*/
|
||||
startActivity: any /* androidx.appcompat.app.AppCompatActivity */;
|
||||
|
||||
/**
|
||||
* Gets the orientation of the application.
|
||||
* Available values: "portrait", "landscape", "unknown".
|
||||
*/
|
||||
orientation: "portrait" | "landscape" | "unknown";
|
||||
/**
|
||||
* Gets the orientation of the application.
|
||||
* Available values: "portrait", "landscape", "unknown".
|
||||
*/
|
||||
orientation: 'portrait' | 'landscape' | 'unknown';
|
||||
|
||||
/**
|
||||
* Gets the system appearance.
|
||||
* Available values: "dark", "light".
|
||||
*/
|
||||
systemAppearance: "dark" | "light";
|
||||
/**
|
||||
* Gets the system appearance.
|
||||
* Available values: "dark", "light".
|
||||
*/
|
||||
systemAppearance: 'dark' | 'light';
|
||||
|
||||
/**
|
||||
* The name of the application package.
|
||||
*/
|
||||
packageName: string;
|
||||
/**
|
||||
* The name of the application package.
|
||||
*/
|
||||
packageName: string;
|
||||
|
||||
/**
|
||||
* True if the main application activity is not running (suspended), false otherwise.
|
||||
*/
|
||||
paused: boolean;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* 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
|
||||
);
|
||||
/**
|
||||
* 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 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 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 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 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 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 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 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 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: 'activityBackPressed', callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the Android app was launched by an Intent with data.
|
||||
*/
|
||||
on(
|
||||
event: "activityNewIntent",
|
||||
callback: (args: AndroidActivityNewIntentEventData) => void,
|
||||
thisArg?: any
|
||||
);
|
||||
/**
|
||||
* This event is raised when the Android app was launched by an Intent with data.
|
||||
*/
|
||||
on(event: 'activityNewIntent', callback: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any);
|
||||
|
||||
/**
|
||||
* This event is raised when the Android activity requests permissions.
|
||||
*/
|
||||
on(
|
||||
event: "activityRequestPermissions",
|
||||
callback: (args: AndroidActivityRequestPermissionsEventData) => void,
|
||||
thisArg?: any
|
||||
);
|
||||
/**
|
||||
* This event is raised when the Android activity requests permissions.
|
||||
*/
|
||||
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 activityCreated event.
|
||||
*/
|
||||
public static activityCreatedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityDestroyed event.
|
||||
*/
|
||||
public static activityDestroyedEvent: 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 activityStarted event.
|
||||
*/
|
||||
public static activityStartedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityPaused event.
|
||||
*/
|
||||
public static activityPausedEvent: 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 activityResumed event.
|
||||
*/
|
||||
public static activityResumedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityStopped event.
|
||||
*/
|
||||
public static activityStoppedEvent: 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 saveActivityState event.
|
||||
*/
|
||||
public static saveActivityStateEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityResult event.
|
||||
*/
|
||||
public static activityResultEvent: 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 activityBackPressed event.
|
||||
*/
|
||||
public static activityBackPressedEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to activityNewIntent event.
|
||||
*/
|
||||
public static activityNewIntentEvent: string;
|
||||
/**
|
||||
* String value used when hooking to activityNewIntent event.
|
||||
*/
|
||||
public static activityNewIntentEvent: string;
|
||||
|
||||
/**
|
||||
* String value used when hooking to requestPermissions event.
|
||||
*/
|
||||
public static activityRequestPermissionsEvent: 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;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* 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 */
|
||||
@@ -704,67 +599,64 @@ export class AndroidApplication extends Observable {
|
||||
* The abstraction of an iOS-specific application object.
|
||||
*/
|
||||
export class iOSApplication {
|
||||
/* tslint:enable */
|
||||
/**
|
||||
* The root view controller for the application.
|
||||
*/
|
||||
rootController: any /* UIViewController */;
|
||||
/* tslint:enable */
|
||||
/**
|
||||
* The root view controller for the application.
|
||||
*/
|
||||
rootController: any /* UIViewController */;
|
||||
|
||||
/* tslint:enable */
|
||||
/**
|
||||
* The key window.
|
||||
*/
|
||||
window: any /* UIWindow */;
|
||||
/* tslint:enable */
|
||||
/**
|
||||
* The key window.
|
||||
*/
|
||||
window: any /* UIWindow */;
|
||||
|
||||
/**
|
||||
* The [UIApplicationDelegate](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html) class.
|
||||
*/
|
||||
delegate: any /* typeof UIApplicationDelegate */;
|
||||
/**
|
||||
* The [UIApplicationDelegate](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html) class.
|
||||
*/
|
||||
delegate: any /* typeof UIApplicationDelegate */;
|
||||
|
||||
/**
|
||||
* Gets or sets the orientation of the application.
|
||||
* Available values: "portrait", "landscape", "unknown".
|
||||
*/
|
||||
orientation: "portrait" | "landscape" | "unknown";
|
||||
/**
|
||||
* Gets or sets the orientation of the application.
|
||||
* Available values: "portrait", "landscape", "unknown".
|
||||
*/
|
||||
orientation: 'portrait' | 'landscape' | 'unknown';
|
||||
|
||||
/**
|
||||
* Gets the system appearance.
|
||||
* Available values: "dark", "light", null.
|
||||
* Null for iOS <= 11.
|
||||
*/
|
||||
systemAppearance: "dark" | "light" | null;
|
||||
/**
|
||||
* Gets the system appearance.
|
||||
* Available values: "dark", "light", null.
|
||||
* Null for iOS <= 11.
|
||||
*/
|
||||
systemAppearance: 'dark' | 'light' | null;
|
||||
|
||||
/**
|
||||
* The [UIApplication](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html).
|
||||
*/
|
||||
nativeApp: any /* UIApplication */;
|
||||
/**
|
||||
* The [UIApplication](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html).
|
||||
*/
|
||||
nativeApp: any /* UIApplication */;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
export interface RootViewControllerImpl {
|
||||
contentController: any;
|
||||
contentController: any;
|
||||
}
|
||||
|
||||
export function getNativeApplication(): any;
|
||||
@@ -775,5 +667,5 @@ export function getNativeApplication(): any;
|
||||
export function hasLaunched(): boolean;
|
||||
|
||||
export interface LoadAppCSSEventData extends EventData {
|
||||
cssFile: string;
|
||||
cssFile: string;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user