JavaScript APIs / oro:window

oro:window

oro:window provides the ApplicationWindow class and window-specific methods.

You typically do not import this module directly—get window instances via oro:application:

import application from 'oro:application'

const current = await application.getCurrentWindow()

Common operations#

const win = await application.getCurrentWindow()

await win.setTitle('Hello')
await win.setSize({ width: '80%', height: '80%' })
await win.navigate('index.html')

Messaging#

Send a message to another window:

const detailsWindow = await application.getWindow(1)
await detailsWindow.postMessage({ type: 'ping' })

Receive messages:

globalThis.addEventListener('message', (event) => {
  const payload = event.detail ?? event.data
  console.log(payload)
})

File pickers#

ApplicationWindow exposes native file pickers:

const win = await application.getCurrentWindow()

const paths = await win.showOpenFilePicker({ multiple: true })
console.log(paths)

Native Back, insets, and gesture policy#

Android also adds markReady() / markPresented(), explicit setSystemAppearance, native setFullscreen / getFullscreenState, setContentProtection, and file sharing. Read Android window presentation and sharing before adopting these platform-specific controls; startup presentation is not readiness, and native fullscreen is separate from DOM fullscreen.

The oro:window/back subpath installs one document-owned Back handler on Android or Linux. Return true to consume Back or false to continue native navigation. Promise results must settle within the native 750 ms deadline; missing replies, thrown errors, and stalled renderers fall back to native navigation. Native IME dismissal and fullscreen exit take priority. Dispose the handler with the view and install it again after navigation or renderer replacement.

oro:window/appearance adds onInsetsChange and onBackGesture subscriptions plus bounded Android setGestureExclusion / getGestureExclusion. Region coordinates are CSS pixels under the documented edge/size limits; a submitted rectangle does not prove OS acceptance. See native platform services for platform and lifecycle boundaries.

API reference#

Module specifiers#

oro:window
oro:window/appearance
oro:window/back
oro:window/constants
oro:window/hotkey

TypeScript declarations#

These declarations are generated from the runtime's published TypeScript surface.

oro:window#

declare module "oro:window" {
    /**
     * @typedef {object} FullscreenState
     * @property {boolean} supported Android 11+ native presentation is supported.
     * @property {boolean} active Whether a window currently owns fullscreen.
     * @property {number|null} owner Current fullscreen window index.
     * @property {boolean} customView Whether a browser custom view is being shown.
     * @property {boolean} requiresManagedInsets Call setSystemAppearance before entry.
     * @property {boolean} pointerCapture False; native fullscreen does not capture a pointer.
     */
    /**
     * @typedef {object} ContentProtectionState
     * @property {boolean} enabled Protection requested for this window.
     * @property {boolean} activityProtected Android currently protects the entire activity.
     */
    /**
     * @typedef {object} ShareOptions
     * @property {string} [title]
     * @property {string} [text]
     * @property {string} [url]
     * @property {File[]} [files] Android only: up to 16 files, 8 MiB total.
     */
    /**
     * @typedef {object} SystemAppearanceOptions
     * @property {'system'|'light'|'dark'} theme System bar icon contrast.
     * @property {string} color Opaque surface color, exactly `#rrggbb`.
     * @property {'native'|'web'} insets Explicit inset owner. Native pads content;
     * web emits CSS-pixel insets for the app to consume. Stop app-owned native inset
     * listeners before adopting this API to prevent double padding. Runtime disables
     * automatic IME resizing while the opted-in window is foreground.
     */
    /**
     * @param {string} url
     * @return {string}
     * @ignore
     */
    export function formatURL(url: string): string;
    /**
     * @class ApplicationWindow
     * Represents a window in the application
     */
    export class ApplicationWindow extends EventTarget {
        static constants: typeof statuses;
        static hotkey: import("oro:window/hotkey").Bindings;
        constructor({ index, ...state }: {
            [x: string]: any;
            index: any;
        });
        /**
         * The unique ID of this window.
         * @type {string}
         */
        get id(): string;
        /**
         * Get the index of the window
         * @return {number} - the index of the window
         */
        get index(): number;
        /**
         * @type {import('./window/hotkey.js').default}
         */
        get hotkey(): import("oro:window/hotkey").Bindings;
        get state(): {
            [x: string]: any;
        };
        /**
         * The broadcast channel for this window.
         * @type {BroadcastChannel}
         */
        get channel(): BroadcastChannel;
        /**
         * Get the size of the window
         * @type {{ width: number, height: number }} - the size of the window
         */
        get size(): {
            width: number;
            height: number;
        };
        get location(): any;
        /**
         * get  the position of the window
         * @type {{ x: number, y: number }} - the position of the window
         */
        get position(): {
            x: number;
            y: number;
        };
        /**
         * get  the title of the window
         * @type {string}
         */
        get title(): string;
        /**
         * Indicates whether the window follows the host desktop theme.
         * @type {boolean}
         */
        get followSystemTheme(): boolean;
        /**
         * Indicates whether the window prefers a dark theme when not
         * following the system theme.
         * @type {boolean}
         */
        get preferDarkTheme(): boolean;
        /**
         * Whether the window is currently in dark mode.
         * @type {boolean}
         */
        get isDarkMode(): boolean;
        /**
         * Current appearance metadata for the window.
         * @type {{ followSystemTheme: boolean, preferDarkTheme: boolean, isDarkMode: boolean, backgroundColor: { red: number, green: number, blue: number, alpha: number } }}
         */
        get appearance(): {
            followSystemTheme: boolean;
            preferDarkTheme: boolean;
            isDarkMode: boolean;
            backgroundColor: {
                red: number;
                green: number;
                blue: number;
                alpha: number;
            };
        };
        /**
         * @type {string}
         */
        get token(): string;
        /**
         * get  the status of the window
         * @type {number} - the status of the window
         */
        get status(): number;
        /**
         * Get the size of the window
         * @return {{ width: number, height: number }} - the size of the window
         */
        getSize(): {
            width: number;
            height: number;
        };
        /**
         * Get the position of the window
         * @return {{ x: number, y: number }} - the position of the window
         */
        getPosition(): {
            x: number;
            y: number;
        };
        /**
         * Get the title of the window
         * @return {string} - the title of the window
         */
        getTitle(): string;
        /**
         * Get the status of the window
         * @return {number} - the status of the window
         */
        getStatus(): number;
        /**
         * Close the window
         * Android rejects with `ENOTREADY` while Activity state is saved or unavailable.
         * @return {Promise<object>} - the options of the window
         */
        close(): Promise<object>;
        /**
         * Shows the window
         * Android rejects with `ENOTREADY` while Activity state is saved or unavailable.
         * @return {Promise<ipc.Result>}
         */
        show(): Promise<ipc.Result>;
        /**
         * Hides the window
         * Android rejects with `ENOTREADY` while Activity state is saved or unavailable.
         * @return {Promise<ipc.Result>}
         */
        hide(): Promise<ipc.Result>;
        /**
         * Brings the window to the foreground and focuses it.
         * @return {Promise<ipc.Result>}
         */
        focus(): Promise<ipc.Result>;
        /**
         * Removes focus from the window (desktop: sends to back; mobile: hides).
         * @return {Promise<ipc.Result>}
         */
        blur(): Promise<ipc.Result>;
        /**
         * Maximize the window
         * @return {Promise<ipc.Result>}
         */
        maximize(): Promise<ipc.Result>;
        /**
         * Minimize the window
         * @return {Promise<ipc.Result>}
         */
        minimize(): Promise<ipc.Result>;
        /**
         * Restore the window
         * @return {Promise<ipc.Result>}
         */
        restore(): Promise<ipc.Result>;
        /**
         * Sets the title of the window
         * @param {string} title - the title of the window
         * @return {Promise<ipc.Result>}
         */
        setTitle(title: string): Promise<ipc.Result>;
        /**
         * Sets the size of the window
         * @param {object} opts - an options object
         * @param {(number|string)=} opts.width - the width of the window
         * @param {(number|string)=} opts.height - the height of the window
         * @return {Promise<ipc.Result>}
         * @throws {Error} - if the width or height is invalid
         */
        setSize(opts: {
            width?: (number | string) | undefined;
            height?: (number | string) | undefined;
        }): Promise<ipc.Result>;
        /**
         * Sets the position of the window
         * @param {object} opts - an options object
         * @param {(number|string)=} opts.x - the x position of the window
         * @param {(number|string)=} opts.y - the y position of the window
         * @return {Promise<object>}
         * @throws {Error} - if the x or y is invalid
         */
        setPosition(opts: {
            x?: (number | string) | undefined;
            y?: (number | string) | undefined;
        }): Promise<object>;
        /**
         * Navigate the window to a given path
         * @param {object} path - file path
         * @return {Promise<ipc.Result>}
         */
        navigate(path: object): Promise<ipc.Result>;
        /**
         * Opens the Web Inspector for the window (desktop only).
         * @return {Promise<object>}
         */
        showInspector(): Promise<object>;
        /**
         * Acknowledges that this window has a usable application screen. Call after
         * mounting the UI and loading required styles. Android apps configured with
         * `[webview] require_ready = true` keep native startup recovery armed until this
         * acknowledgement. Only the current window can acknowledge its own readiness.
         * This does not replay operations or establish application authorization.
         * @returns {Promise<void>}
         */
        markReady(): Promise<void>;
        /**
         * Reveals this Android window's verified bundled startup screen after a native
         * visual-state fence. Call after installing its inline styles and startup UI.
         * This does not acknowledge application readiness or stop the 30-second native
         * watchdog. Keep application controls inert until the usable screen calls
         * markReady(). Failed startup restores native recovery and its Reload control.
         * Requires the current trusted top-level document; foreign origins, headless
         * windows and stale documents cannot reveal a startup screen. Other platforms
         * reject with ENOSYS. Hidden windows do not gain focus from this call.
         * @returns {Promise<void>}
         */
        markPresented(): Promise<void>;
        /**
         * Sets the background color of the window
         * @param {object} opts - an options object
         * @param {number} opts.red - the red value
         * @param {number} opts.green - the green value
         * @param {number} opts.blue - the blue value
         * @param {number} opts.alpha - the alpha value
         * @return {Promise<object>}
         */
        setBackgroundColor(opts: {
            red: number;
            green: number;
            blue: number;
            alpha: number;
        }): Promise<object>;
        /**
         * Gets the background color of the window
         * @return {Promise<string>}
         */
        getBackgroundColor(): Promise<string>;
        /**
         * Opens a native context menu.
         * @param {object} options - an options object
         * @return {Promise<object>}
         */
        setContextMenu(options: object): Promise<object>;
        /**
         * Sets whether the window should stay always on top (desktop only).
         * @param {boolean} enabled
         * @return {Promise<ipc.Result>}
         */
        setAlwaysOnTop(enabled: boolean): Promise<ipc.Result>;
        /**
         * Checks if the window is set to always be on top (desktop only).
         * @return {Promise<boolean>}
         */
        isAlwaysOnTop(): Promise<boolean>;
        /**
         * Shows a native open file dialog.
         * @param {object} options - an options object
         * @return {Promise<string[]>} - an array of file paths
         */
        showOpenFilePicker(options: object): Promise<string[]>;
        /**
         * Shows a native save file dialog.
         * @param {object} options - an options object
         * @return {Promise<string|null>} - the selected file path or null
         */
        showSaveFilePicker(options: object): Promise<string | null>;
        /**
         * Shows a native directory dialog.
         * @param {object} options - an options object
         * @return {Promise<string[]>} - an array of file paths
         */
        showDirectoryFilePicker(options: object): Promise<string[]>;
        /**
         * Opens the platform share sheet for the current window.
         * New Android file opens expire after 24 hours. Recipients can retain copies.
         * Resolution means a share target was selected, not that delivery completed.
         * @param {ShareOptions} [options]
         * @return {Promise<void>}
         */
        share(options?: ShareOptions): Promise<void>;
        /**
         * Sets Android 11+ system surfaces for this window. The foreground window owns
         * appearance; `system` follows configuration changes. Insets/IME updates arrive
         * as `windowinsetschange` CustomEvents. Earlier Android versions and other
         * platforms reject with `ENOSYS`.
         * @param {SystemAppearanceOptions} options
         * @returns {Promise<void>}
         */
        setSystemAppearance(options: SystemAppearanceOptions): Promise<void>;
        /**
         * Enters or exits Android 11+ native fullscreen for the current foreground
         * window. First select explicit inset ownership with setSystemAppearance.
         * A native Exit fullscreen control, Back, suspension, hiding, and renderer
         * destruction exit presentation. Entry never captures a pointer or hides IME.
         * Observe windowfullscreenchange for native exits. Browser DOM fullscreen is
         * a separate capability. Other platforms reject with ENOSYS.
         * @param {boolean} enabled
         * @returns {Promise<FullscreenState>}
         */
        setFullscreen(enabled: boolean): Promise<FullscreenState>;
        /**
         * Reads Android native fullscreen state for the current foreground window.
         * Other platforms reject with ENOSYS.
         * @returns {Promise<FullscreenState>}
         */
        getFullscreenState(): Promise<FullscreenState>;
        /**
         * Requests Android FLAG_SECURE while this window is visible. The whole native
         * activity is protected, including recents previews and ordinary screenshots.
         * This does not protect clipboard, shared files, external displays, or secrets
         * already exported by the application. Custom native flag owners must coordinate
         * with this runtime API. Other platforms reject with ENOSYS.
         * @param {boolean} enabled
         * @returns {Promise<ContentProtectionState>}
         */
        setContentProtection(enabled: boolean): Promise<ContentProtectionState>;
        /**
         * This is a high-level API that you should use instead of `ipc.request` when
         * you want to send a message to another window or to the backend.
         *
         * @param {object} options - an options object
         * @param {number=} options.window - the window to send the message to
         * @param {boolean=} [options.backend = false] - whether to send the message to the backend
         * @param {string} options.event - the event to send
         * @param {(string|object)=} options.value - the value to send
         * @returns
         */
        send(options: {
            window?: number | undefined;
            backend?: boolean | undefined;
            event: string;
            value?: (string | object) | undefined;
        }): Promise<any>;
        /**
         * Post a message to a window
         * TODO(@jwerle): research using `BroadcastChannel` instead
         * @param {object} data
         * @return {Promise}
         */
        postMessage(data: object): Promise<any>;
        /**
         * Opens an URL in the default application associated with the URL protocol,
         * such as 'https:' for the default web browser.
         * @param {string} value
         * @returns {Promise<{ url: string }>}
         */
        openExternal(value: string): Promise<{
            url: string;
        }>;
        /**
         * Opens a file in the default file explorer.
         * @param {string} value
         * @returns {Promise}
         */
        revealFile(value: string): Promise<any>;
        /**
         * Updates window state
         * @return {Promise<ipc.Result>}
         */
        update(): Promise<ipc.Result>;
        /**
         * Adds a listener to the window.
         * @param {string} event - the event to listen to
         * @param {function(*): void} cb - the callback to call
         * @returns {void}
         */
        addListener(event: string, cb: (arg0: any) => void): void;
        /**
         * Adds a listener to the window. An alias for `addListener`.
         * @param {string} event - the event to listen to
         * @param {function(*): void} cb - the callback to call
         * @returns {void}
         * @see addListener
         */
        on(event: string, cb: (arg0: any) => void): void;
        /**
         * Adds a listener to the window. The listener is removed after the first call.
         * @param {string} event - the event to listen to
         * @param {function(*): void} cb - the callback to call
         * @returns {void}
         */
        once(event: string, cb: (arg0: any) => void): void;
        /**
         * Removes a listener from the window.
         * @param {string} event - the event to remove the listener from
         * @param {function(*): void} cb - the callback to remove
         * @returns {void}
         */
        removeListener(event: string, cb: (arg0: any) => void): void;
        /**
         * Removes all listeners from the window.
         * @param {string} event - the event to remove the listeners from
         * @returns {void}
         */
        removeAllListeners(event: string): void;
        /**
         * Removes a listener from the window. An alias for `removeListener`.
         * @param {string} event - the event to remove the listener from
         * @param {function(*): void} cb - the callback to remove
         * @returns {void}
         * @see removeListener
         */
        off(event: string, cb: (arg0: any) => void): void;
        #private;
    }
    export default ApplicationWindow;
    /**
     * @ignore
     */
    export const constants: typeof statuses;
    export type FullscreenState = {
        /**
         * Android 11+ native presentation is supported.
         */
        supported: boolean;
        /**
         * Whether a window currently owns fullscreen.
         */
        active: boolean;
        /**
         * Current fullscreen window index.
         */
        owner: number | null;
        /**
         * Whether a browser custom view is being shown.
         */
        customView: boolean;
        /**
         * Call setSystemAppearance before entry.
         */
        requiresManagedInsets: boolean;
        /**
         * False; native fullscreen does not capture a pointer.
         */
        pointerCapture: boolean;
    };
    export type ContentProtectionState = {
        /**
         * Protection requested for this window.
         */
        enabled: boolean;
        /**
         * Android currently protects the entire activity.
         */
        activityProtected: boolean;
    };
    export type ShareOptions = {
        title?: string;
        text?: string;
        url?: string;
        /**
         * Android only: up to 16 files, 8 MiB total.
         */
        files?: File[];
    };
    export type SystemAppearanceOptions = {
        /**
         * System bar icon contrast.
         */
        theme: "system" | "light" | "dark";
        /**
         * Opaque surface color, exactly `#rrggbb`.
         */
        color: string;
        /**
         * Explicit inset owner. Native pads content;
         * web emits CSS-pixel insets for the app to consume. Stop app-owned native inset
         * listeners before adopting this API to prevent double padding. Runtime disables
         * automatic IME resizing while the opted-in window is foreground.
         */
        insets: "native" | "web";
    };
    import ipc from "oro:ipc";
    import * as statuses from "oro:window/constants";
    import client from "oro:application/client";
    import hotkey from "oro:window/hotkey";
    export { client, hotkey };
}

oro:window/appearance#

declare module "oro:window/appearance" {
    /**
     * @typedef {object} GestureExclusionRegion
     * @property {'left'|'right'} edge Visible handle's edge in the native WebView.
     * @property {number} top Fraction of native client height in [0, 1).
     * @property {number} height Positive fraction of native client height; top + height must be <= 1.
     */
    /**
     * @typedef {object} GestureExclusionRect
     * @property {number} left Native view pixels.
     * @property {number} top Native view pixels.
     * @property {number} right Native view pixels.
     * @property {number} bottom Native view pixels.
     */
    /**
     * @typedef {object} GestureExclusionState
     * @property {boolean} supported Android 10+ supports requesting exclusion.
     * @property {boolean} active This document owns a current native request, not proof that Android accepted it.
     * @property {number} viewportWidth Native WebView width in pixels.
     * @property {number} viewportHeight Native WebView height in pixels.
     * @property {number} density Native display density.
     * @property {number} maximumRegions Four regions in total.
     * @property {number} maximumWidthDp Fixed maximum edge-strip width: 24dp, also capped at a quarter of the viewport.
     * @property {number} maximumEdgeHeightDp Maximum combined height per edge: 200dp, also capped at half the viewport.
     * @property {boolean} osAcceptanceKnown Always false; Android owns the effective gesture policy.
     * @property {GestureExclusionRect[]} rects Registered, clipped rectangles in native view pixels.
     */
    /**
     * Requests system-gesture exclusion for up to four small visible edge handles
     * in the current trusted foreground document. Fractions refer to native client
     * height, so app code must map its handle geometry after layout. Android retains
     * mandatory navigation gestures and may further restrict or ignore a request.
     * Empty regions clear this document's request. Navigation, pause, hiding, focus
     * loss, detachment or native geometry/configuration changes clear it; returning
     * to the app never restores it automatically. Reapply only for a visible handle.
     * Oversized requests reject without replacing the existing request. Other
     * platforms reject with ENOSYS; nonempty requests below Android 10 use ENOTSUP.
     * @param {GestureExclusionRegion[]} regions
     * @returns {Promise<GestureExclusionState>}
     */
    export function setGestureExclusion(regions: GestureExclusionRegion[]): Promise<GestureExclusionState>;
    /**
     * Reads this document's exclusion request without renewing its ownership.
     * Rectangles describe registered view regions, not OS acceptance or a gesture
     * navigation mode. App drawer/focus/animation behavior remains application code.
     * @returns {Promise<GestureExclusionState>}
     */
    export function getGestureExclusion(): Promise<GestureExclusionState>;
    /**
     * Observes changes after `ApplicationWindow.setSystemAppearance()` selects an
     * inset owner. An `end` event also covers interrupted platform IME animations;
     * use the reported inset values as the current state, not the target fraction.
     * @param {(insets: WindowInsets) => void} callback
     * @returns {() => void} Unsubscribe.
     */
    export function onInsetsChange(callback: (insets: WindowInsets) => void): () => void;
    /**
     * Observes the runtime activity's Back callback. Progress requires Android 14+.
     * Start/progress/cancel never navigate; commit follows native history/activity
     * handling. This observation does not intercept Back or replace an application's
     * modal/drawer dismissal priority. Custom native callbacks must forward events.
     * @param {(gesture: BackGesture) => void} callback
     * @returns {() => void} Unsubscribe.
     */
    export function onBackGesture(callback: (gesture: BackGesture) => void): () => void;
    namespace _default {
        export { onInsetsChange };
        export { onBackGesture };
        export { setGestureExclusion };
        export { getGestureExclusion };
    }
    export default _default;
    export type GestureExclusionRegion = {
        /**
         * Visible handle's edge in the native WebView.
         */
        edge: "left" | "right";
        /**
         * Fraction of native client height in [0, 1).
         */
        top: number;
        /**
         * Positive fraction of native client height; top + height must be <= 1.
         */
        height: number;
    };
    export type GestureExclusionRect = {
        /**
         * Native view pixels.
         */
        left: number;
        /**
         * Native view pixels.
         */
        top: number;
        /**
         * Native view pixels.
         */
        right: number;
        /**
         * Native view pixels.
         */
        bottom: number;
    };
    export type GestureExclusionState = {
        /**
         * Android 10+ supports requesting exclusion.
         */
        supported: boolean;
        /**
         * This document owns a current native request, not proof that Android accepted it.
         */
        active: boolean;
        /**
         * Native WebView width in pixels.
         */
        viewportWidth: number;
        /**
         * Native WebView height in pixels.
         */
        viewportHeight: number;
        /**
         * Native display density.
         */
        density: number;
        /**
         * Four regions in total.
         */
        maximumRegions: number;
        /**
         * Fixed maximum edge-strip width: 24dp, also capped at a quarter of the viewport.
         */
        maximumWidthDp: number;
        /**
         * Maximum combined height per edge: 200dp, also capped at half the viewport.
         */
        maximumEdgeHeightDp: number;
        /**
         * Always false; Android owns the effective gesture policy.
         */
        osAcceptanceKnown: boolean;
        /**
         * Registered, clipped rectangles in native view pixels.
         */
        rects: GestureExclusionRect[];
    };
    export type WindowInsets = {
        /**
         * Which layer consumes the insets.
         */
        ownership: "native" | "web";
        /**
         * IME animation or ordinary inset change.
         */
        phase: "change" | "start" | "progress" | "end";
        /**
         * Animation fraction, bounded to [0, 1].
         */
        progress: number;
        /**
         * CSS pixels, including cutouts.
         */
        left: number;
        /**
         * CSS pixels, including status bars.
         */
        top: number;
        /**
         * CSS pixels, including cutouts.
         */
        right: number;
        /**
         * Navigation-bar CSS pixels.
         */
        bottom: number;
        /**
         * Keyboard bottom inset in CSS pixels.
         */
        imeBottom: number;
        imeVisible: boolean;
    };
    export type BackGesture = {
        phase: "start" | "progress" | "cancel" | "commit";
        /**
         * Gesture fraction, bounded to [0, 1].
         */
        progress: number;
        /**
         * Android swipe edge; null for non-gesture Back.
         */
        edge: number | null;
    };
}

oro:window/back#

declare module "oro:window/back" {
    /**
     * @typedef {object} BackRequest
     * @property {number} deadlineMs Native fallback deadline, 750 milliseconds.
     */
    /**
     * @typedef {object} BackHandlerOptions
     * @property {AbortSignal} [signal] Removes the handler when aborted.
     */
    /**
     * Installs one handler for this document. Return true to consume Back, or false
     * to use native navigation. Promise results are accepted within 750 ms. Throws,
     * missing replies and stalled renderers use native navigation. Navigation or
     * renderer replacement invalidates registration; install again in the new page.
     * Application code decides modal, drawer and router priority. Gesture progress
     * remains available through the existing backgesture event.
     * The original live document can remove its registration while hidden or while
     * its Activity is paused. Removal never grants foreground access or disables a
     * replacement document's handler.
     * @param {(request: BackRequest) => boolean|Promise<boolean>} handler
     * @param {BackHandlerOptions} [options]
     * @returns {Promise<() => Promise<void>>} Idempotent handler removal.
     */
    export function setHandler(handler: (request: BackRequest) => boolean | Promise<boolean>, options?: BackHandlerOptions): Promise<() => Promise<void>>;
    namespace _default {
        export { setHandler };
    }
    export default _default;
    export type BackRequest = {
        /**
         * Native fallback deadline, 750 milliseconds.
         */
        deadlineMs: number;
    };
    export type BackHandlerOptions = {
        /**
         * Removes the handler when aborted.
         */
        signal?: AbortSignal;
    };
}

oro:window/constants#

declare module "oro:window/constants" {
    export const WINDOW_ERROR: -1;
    export const WINDOW_NONE: 0;
    export const WINDOW_CREATING: 10;
    export const WINDOW_CREATED: 11;
    export const WINDOW_HIDING: 20;
    export const WINDOW_HIDDEN: 21;
    export const WINDOW_SHOWING: 30;
    export const WINDOW_SHOWN: 31;
    export const WINDOW_CLOSING: 40;
    export const WINDOW_CLOSED: 41;
    export const WINDOW_EXITING: 50;
    export const WINDOW_EXITED: 51;
    export const WINDOW_KILLING: 60;
    export const WINDOW_KILLED: 61;
    export default exports;
    import * as exports from "oro:window/constants";

}

oro:window/hotkey#

declare module "oro:window/hotkey" {
    /**
     * Normalizes an expression string.
     * @param {string} expression
     * @return {string}
     */
    export function normalizeExpression(expression: string): string;
    /**
     * Bind a global hotkey expression.
     * @param {string} expression
     * @param {{ passive?: boolean }} [options]
     * @return {Promise<Binding>}
     */
    export function bind(expression: string, options?: {
        passive?: boolean;
    }): Promise<Binding>;
    /**
     * Bind a global hotkey expression.
     * @param {string} expression
     * @param {object=} [options]
     * @return {Promise<Binding>}
     */
    export function unbind(id: any, options?: object | undefined): Promise<Binding>;
    /**
     * Get all known globally register hotkey bindings.
     * @param {object=} [options]
     * @return {Promise<Binding[]>}
     */
    export function getBindings(options?: object | undefined): Promise<Binding[]>;
    /**
     * Get all known possible keyboard modifier and key mappings for
     * expression bindings.
     * @param {object=} [options]
     * @return {Promise<{ keys: object, modifiers: object }>}
     */
    export function getMappings(options?: object | undefined): Promise<{
        keys: object;
        modifiers: object;
    }>;
    /**
     * Adds an event listener to the global active bindings. This function is just
     * proxy to `bindings.addEventListener`.
     * @param {string} type
     * @param {function(Event)} listener
     * @param {(boolean|object)=} [optionsOrUseCapture]
     */
    export function addEventListener(type: string, listener: (arg0: Event) => any, optionsOrUseCapture?: (boolean | object) | undefined): void;
    /**
     * Removes  an event listener to the global active bindings. This function is
     * just a proxy to `bindings.removeEventListener`
     * @param {string} type
     * @param {function(Event)} listener
     * @param {(boolean|object)=} [optionsOrUseCapture]
     */
    export function removeEventListener(type: string, listener: (arg0: Event) => any, optionsOrUseCapture?: (boolean | object) | undefined): void;
    /**
     * A high level bindings container map that dispatches events.
     */
    export class Bindings extends EventTarget {
        [x: number]: () => import("oro:gc").Finalizer;
        /**
         * `Bindings` class constructor.
         * @ignore
         * @param {EventTarget} [sourceEventTarget]
         */
        constructor(sourceEventTarget?: EventTarget);
        /**
         * Global `HotKeyEvent` event listener for `Binding` instance event dispatch.
         * @ignore
         * @param {import('../internal/events.js').HotKeyEvent} event
         */
        onHotKey(event: import("oro:internal/events").HotKeyEvent): boolean;
        /**
         * The number of `Binding` instances in the mapping.
         * @type {number}
         */
        get size(): number;
        /**
         * Setter for the level 1 'error'` event listener.
         * @ignore
         * @type {function(ErrorEvent)?}
         */
        set onerror(onerror: ((arg0: ErrorEvent) => any) | null);
        /**
         * Level 1 'error'` event listener.
         * @type {function(ErrorEvent)?}
         */
        get onerror(): ((arg0: ErrorEvent) => any) | null;
        /**
         * Setter for the level 1 'hotkey'` event listener.
         * @ignore
         * @type {function(import('../internal/events.js').HotKeyEvent)?}
         */
        set onhotkey(onhotkey: ((arg0: import("oro:internal/events").HotKeyEvent) => any) | null);
        /**
         * Level 1 'hotkey'` event listener.
         * @type {function(import('../internal/events.js').HotKeyEvent)?}
         */
        get onhotkey(): ((arg0: import("oro:internal/events").HotKeyEvent) => any) | null;
        /**
         * Initializes bindings from global context.
         * @ignore
         * @return {Promise}
         */
        init(): Promise<any>;
        /**
         * Get a binding by `id`
         * @param {number} id
         * @return {Binding}
         */
        get(id: number): Binding;
        /**
         * Set a `binding` a by `id`.
         * @param {number} id
         * @param {Binding} binding
         */
        set(id: number, binding: Binding): void;
        /**
         * Delete a binding by `id`
         * @param {number} id
         * @return {boolean}
         */
        delete(id: number): boolean;
        /**
         * Returns `true` if a binding exists in the mapping, otherwise `false`.
         * @return {boolean}
         */
        has(id: any): boolean;
        /**
         * Known `Binding` values in the mapping.
         * @return {{ next: function(): { value: Binding|undefined, done: boolean } }}
         */
        values(): {
            next: () => {
                value: Binding | undefined;
                done: boolean;
            };
        };
        /**
         * Known `Binding` keys in the mapping.
         * @return {{ next: function(): { value: number|undefined, done: boolean } }}
         */
        keys(): {
            next: () => {
                value: number | undefined;
                done: boolean;
            };
        };
        /**
         * Known `Binding` ids in the mapping.
         * @return {{ next: function(): { value: number|undefined, done: boolean } }}
         */
        ids(): {
            next: () => {
                value: number | undefined;
                done: boolean;
            };
        };
        /**
         * Known `Binding` ids and values in the mapping.
         * @return {{ next: function(): { value: [number, Binding]|undefined, done: boolean } }}
         */
        entries(): {
            next: () => {
                value: [number, Binding] | undefined;
                done: boolean;
            };
        };
        /**
         * Bind a global hotkey expression.
         * @param {string} expression
         * @return {Promise<Binding>}
         */
        bind(expression: string): Promise<Binding>;
        /**
         * Bind a global hotkey expression.
         * @param {string} expression
         * @return {Promise<Binding>}
         */
        unbind(expression: string): Promise<Binding>;
        /**
         * Returns an array of all active bindings for the application.
         * @return {Promise<Binding[]>}
         */
        active(): Promise<Binding[]>;
        /**
         * Resets all active bindings in the application.
         * @param {boolean=} [currentContextOnly]
         * @return {Promise}
         */
        reset(currentContextOnly?: boolean | undefined): Promise<any>;
        /**
         * Implements the `Iterator` protocol for each currently registered
         * active binding in this window context. The `AsyncIterator` protocol
         * will probe for all gloally active bindings.
         * @return {Iterator<Binding>}
         */
        [Symbol.iterator](): Iterator<Binding>;
        /**
         * Implements the `AsyncIterator` protocol for each globally active
         * binding registered to the application. This differs from the `Iterator`
         * protocol as this will probe for _all_ active bindings in the entire
         * application context.
         * @return {AsyncGenerator<Binding>}
         */
        [Symbol.asyncIterator](): AsyncGenerator<Binding>;
        #private;
    }
    /**
     * An `EventTarget` container for a hotkey binding.
     */
    export class Binding extends EventTarget {
        /**
         * `Binding` class constructor.
         * @ignore
         * @param {object} data
         */
        constructor(data: object);
        /**
         * `true` if the binding is valid, otherwise `false`.
         * @type {boolean}
         */
        get isValid(): boolean;
        /**
         * `true` if the binding is considered active, otherwise `false`.
         * @type {boolean}
         */
        get isActive(): boolean;
        /**
         * The global unique ID for this binding.
         * @type {number?}
         */
        get id(): number | null;
        /**
         * The computed hash for this binding expression.
         * @type {number?}
         */
        get hash(): number | null;
        /**
         * The normalized expression as a sequence of tokens.
         * @type {string[]}
         */
        get sequence(): string[];
        /**
         * The original expression of the binding.
         * @type {string?}
         */
        get expression(): string | null;
        /**
         * Setter for the level 1 'hotkey'` event listener.
         * @ignore
         * @type {function(import('../internal/events.js').HotKeyEvent)?}
         */
        set onhotkey(onhotkey: ((arg0: import("oro:internal/events").HotKeyEvent) => any) | null);
        /**
         * Level 1 'hotkey'` event listener.
         * @type {function(import('../internal/events.js').HotKeyEvent)?}
         */
        get onhotkey(): ((arg0: import("oro:internal/events").HotKeyEvent) => any) | null;
        /**
         * Binds this hotkey expression.
         * @return {Promise<Binding>}
         */
        bind(): Promise<Binding>;
        /**
         * Unbinds this hotkey expression.
         * @return {Promise}
         */
        unbind(): Promise<any>;
        /**
         * Implements the `AsyncIterator` protocol for async 'hotkey' events
         * on this binding instance.
         * @return {AsyncGenerator}
         */
        [Symbol.asyncIterator](): AsyncGenerator;
        #private;
    }
    /**
     * A container for all the bindings currently bound
     * by this window context.
     * @type {Bindings}
     */
    export const bindings: Bindings;
    export default bindings;
    import { HotKeyEvent } from "oro:internal/events";
}

See also#

Source repository · Edit this page · View Markdown

Quick links

Type to search across the site. Use the up and down arrow keys to choose a result, Enter to open it, and Escape to close.