UNPKG

@nativescript/core

Version:

A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.

146 lines (145 loc) • 5.95 kB
import type { View } from '../ui/core/view'; import type { NavigationEntry } from '../ui/frame/frame-interfaces'; import { ApplicationCommon } from './application-common'; import { CommonA11YServiceEnabledObservable } from '../accessibility/accessibility-common'; import { CoreTypes } from '../core-types'; declare class NotificationObserver extends NSObject { private _onReceiveCallback; static initWithCallback(onReceiveCallback: (notification: NSNotification) => void): NotificationObserver; onReceive(notification: NSNotification): void; static ObjCExposedMethods: { onReceive: { returns: interop.Type<void>; params: (typeof NSNotification)[]; }; }; } declare class CADisplayLinkTarget extends NSObject { private _owner; static initWithOwner(owner: WeakRef<iOSApplication>): CADisplayLinkTarget; onDisplayed(link: CADisplayLink): void; static ObjCExposedMethods: { onDisplayed: { returns: interop.Type<void>; params: (typeof CADisplayLink)[]; }; }; } export declare class iOSApplication extends ApplicationCommon { private _delegate; private _delegateHandlers; private _rootView; private _sceneDelegate; private _windowSceneMap; private _primaryScene; private _openedScenesById; private _notificationObservers; displayedOnce: boolean; displayedLinkTarget: CADisplayLinkTarget; displayedLink: CADisplayLink; /** * @internal - should not be constructed by the user. */ constructor(); getRootView(): View; resetRootView(view?: View): void; run(entry?: string | NavigationEntry): void; private runAsMainApp; private runAsEmbeddedApp; private getViewController; private setViewControllerView; setMaxRefreshRate(options?: { min?: number; max?: number; preferred?: number; }): void; get rootController(): UIViewController; get nativeApp(): UIApplication; get window(): UIWindow; get delegate(): UIApplicationDelegate & { prototype: UIApplicationDelegate; }; set delegate(value: UIApplicationDelegate | unknown); addDelegateHandler<T extends keyof UIApplicationDelegate>(methodName: T, handler: (typeof UIApplicationDelegate.prototype)[T]): void; getNativeApplication(): UIApplication; addNotificationObserver(notificationName: string, onReceiveCallback: (notification: NSNotification) => void): NotificationObserver; removeNotificationObserver(observer: any, notificationName: string): void; protected getSystemAppearance(): 'light' | 'dark'; private getSystemAppearanceValue; protected getLayoutDirection(): CoreTypes.LayoutDirectionType; private getLayoutDirectionValue; protected getOrientation(): "portrait" | "landscape" | "unknown"; private getOrientationValue; private notifyAppStarted; _notifySceneAppStarted(): void; _onLivesync(context?: ModuleContext): void; private setWindowContent; private didFinishLaunchingWithOptions; private didBecomeActive; private didEnterBackground; private willTerminate; private didReceiveMemoryWarning; private didChangeStatusBarOrientation; private sceneWillConnect; private sceneDidActivate; private sceneWillEnterForeground; private sceneDidEnterBackground; private sceneDidDisconnect; _setWindowForScene(window: UIWindow, scene: UIScene): void; _removeWindowForScene(scene: UIScene): void; _getWindowForScene(scene: UIScene): UIWindow | undefined; _setupWindowForScene(window: UIWindow, scene: UIWindowScene): void; get sceneDelegate(): UIWindowSceneDelegate; set sceneDelegate(value: UIWindowSceneDelegate); /** * Multi-window support */ /** * Opens a new window with the specified data. * @param data The data to pass to the new window. */ openWindow(data: Record<any, any>): void; /** * Closes a secondary window/scene. * Usage examples: * - Application.ios.closeWindow() // best-effort close of a non-primary scene * - Application.ios.closeWindow(button) // from a tap handler within the scene * - Application.ios.closeWindow(window) * - Application.ios.closeWindow(scene) * - Application.ios.closeWindow('scene-id') */ closeWindow(target?: View | UIWindow | UIWindowScene | string): void; getAllWindows(): UIWindow[]; getAllScenes(): UIScene[]; getWindowScenes(): UIWindowScene[]; getPrimaryWindow(): UIWindow; getPrimaryScene(): UIWindowScene | null; supportsScenes(): boolean; supportsMultipleScenes(): boolean; isUsingSceneLifecycle(): boolean; configureForScenes(): void; private _getSceneId; private _resolveScene; private createSceneWithLegacyAPI; /** * Creates a simple view controller with a NativeScript view for a scene window. * @param window The UIWindow to set content for * @param view The NativeScript View to set as root content */ setWindowRootView(window: UIWindow, view: View): void; get ios(): this; } export * from './application-common'; export declare const Application: iOSApplication; export declare const AndroidApplication: any; export declare function getCurrentFontScale(): number; export declare function updateAccessibilityProperties(view: View): void; export declare const sendAccessibilityEvent: () => void; export declare function isAccessibilityServiceEnabled(): boolean; export declare function getAndroidAccessibilityManager(): null; export declare class AccessibilityServiceEnabledObservable extends CommonA11YServiceEnabledObservable { constructor(); } export declare function ensureClasses(): void; export declare function updateCurrentHelperClasses(applyRootCssClass: (cssClasses: string[], newCssClass: string) => void): void; export declare function initAccessibilityCssHelper(): void;