@nativescript/core
Version:
A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.
51 lines (50 loc) • 2.71 kB
TypeScript
/**
* Do not import other files here to avoid circular dependencies.
* Used to define helper functions and variables that are shared between Android and iOS.
* This file can declare cross platform types and use bundler platform checks.
* For example, use `__ANDROID__` or `__APPLE__` to check the platform.
*/
/**
* Application type. UIApplication on iOS or android.app.Application on Android.
*/
type NativeApp = UIApplication | android.app.Application;
/**
* Get the current application instance.
* @returns current application instance, UIApplication on iOS or android.app.Application on Android.
*/
export declare function getNativeApp<T extends NativeApp>(): T;
/**
* This is called internally to set the native application instance.
* You typically do not need to call this directly.
* However, it's exposed for special case purposes, such as custom application initialization.
* @param app The native application instance to set.
* This should be called once during application startup to set the native app instance.
*/
export declare function setNativeApp(app: NativeApp): void;
export declare function getRootView(): any;
export declare function setRootView(view: any): void;
export declare function isAppInBackground(): boolean;
export declare function setAppInBackground(value: boolean): void;
export declare function getiOSWindow(): UIWindow;
export declare function setiOSWindow(value: UIWindow): void;
export declare function getAppMainEntry(): any;
export declare function setAppMainEntry(entry: any): void;
export declare function toggleApplicationEventListeners(toAdd: boolean, callback: (args: any) => void): void;
export declare function setToggleApplicationEventListenersCallback(callback: (toAdd: boolean, callback: (args: any) => void) => void): void;
type ApplicationPropertyValues = {
orientation: 'portrait' | 'landscape' | 'unknown';
systemAppearance: 'dark' | 'light' | null;
};
export declare function getApplicationProperties(): ApplicationPropertyValues;
export declare function setApplicationPropertiesCallback(callback: () => ApplicationPropertyValues): void;
export declare function setA11yUpdatePropertiesCallback(callback: (view: any) => void): void;
export declare function updateA11yPropertiesCallback(view: any): void;
export declare function getImageFetcher(): org.nativescript.widgets.image.Fetcher;
export declare function setImageFetcher(fetcher: org.nativescript.widgets.image.Fetcher): void;
export declare enum CacheMode {
none = 0,
memory = 1,
diskAndMemory = 2
}
export declare function initImageCache(context: android.content.Context, mode?: CacheMode, memoryCacheSize?: number, diskCacheSize?: number): void;
export {};