import * as device_platform from "./platform.ts";
/**
* used by [un]watchDeviceOrientation()
* @ignore
*/
export declare function onDeviceRotate(e: DeviceOrientationEvent): void;
/**
* the device platform type
*/
export declare const platform: typeof device_platform;
/**
* True if the browser supports Touch Events
*/
export declare const touchEvent: boolean;
/**
* True if the browser supports Pointer Events
*/
export declare const pointerEvent = true;
/**
* Touch capabilities (support either Touch or Pointer events)
*/
export declare const touch: boolean;
/**
* the maximum number of simultaneous touch contact points are supported by the current device.
* @example
* if (me.device.maxTouchPoints > 1) {
* // device supports multi-touch
* }
*/
export declare const maxTouchPoints: number;
/**
* W3C standard wheel events
*/
export declare const wheel: boolean;
/**
* Browser pointerlock api support
*/
export declare const hasPointerLockSupport: boolean;
/**
* Browser device orientation
*/
export declare const hasDeviceOrientation = true;
/**
* Supports the ScreenOrientation API
* @see https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/onchange
*/
export declare const screenOrientation: boolean;
/**
* Browser accelerometer capabilities
*/
export declare const hasAccelerometer = true;
export { hasFullscreenSupport, isFullscreen } from "./fullscreen.ts";
/**
* Device WebAudio Support
*/
export declare const hasWebAudio = true;
/**
* Device HTML5Audio Support
*/
export declare const hasHTML5Audio: boolean;
/**
* Returns true if the browser/device has audio capabilities.
*/
export declare const sound = true;
/**
* Device Video Support
*/
export declare const hasVideo: boolean;
/**
* Browser Local Storage capabilities
* (this flag will be set to false if cookies are blocked)
*/
export declare const localStorage: boolean;
/**
* equals to true if the device browser supports OffScreenCanvas.
*/
export declare const offscreenCanvas: boolean;
/**
* Browser Base64 decoding capability
*/
export declare const nativeBase64: boolean;
/**
* a string representing the preferred language of the user, usually the language of the browser UI.
* (will default to "en" if the information is not available)
* @see http://www.w3schools.com/tags/ref_language_codes.asp
*/
export declare const language: string;
/**
* Ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device.
*/
export declare const devicePixelRatio: number;
/**
* equals to true if a mobile device.
* (Android | iPhone | iPad | iPod | any UA matching `Mobi`)
*/
export declare const isMobile: boolean;
/**
* contains the g-force acceleration along the x-axis.
* @see device.watchAccelerometer
*/
export declare let accelerationX: number;
/**
* contains the g-force acceleration along the y-axis.
* @see device.watchAccelerometer
*/
export declare let accelerationY: number;
/**
* contains the g-force acceleration along the z-axis.
* @see device.watchAccelerometer
*/
export declare let accelerationZ: number;
/**
* Device orientation Gamma property. Gives angle on tilting a portrait held phone left or right
* @see device.watchDeviceOrientation
*/
export declare let gamma: number;
/**
* Device orientation Beta property. Gives angle on tilting a portrait held phone forward or backward
* @see device.watchDeviceOrientation
*/
export declare let beta: number;
/**
* Device orientation Alpha property. Gives angle based on the rotation of the phone around its z axis.
* The z-axis is perpendicular to the phone, facing out from the center of the screen.
* @see device.watchDeviceOrientation
*/
export declare let alpha: number;
/**
* Specify whether to automatically bring the window to the front.
*
* Read this binding to inspect the current value; the write surface
* is {@link setAutoFocus} — direct assignment via the ESM namespace
* (`me.device.autoFocus = false`) always threw a `TypeError`, since
* namespace imports are read-only externally regardless of `let` /
* `const`. The setter is the only way to mutate the flag from
* user code.
* @default true
*/
export declare let autoFocus: boolean;
/**
* Update the {@link autoFocus} flag.
* Mirrors the `enableSwipe` / similar function-setter shape used
* elsewhere in this module — the engine's "bring the window to
* the front on visibility restore" behaviour can be toggled via
* `me.device.setAutoFocus(false)`.
* @param enable - `true` to keep the default focus-on-restore behaviour, `false` to opt out
* @example
* // disable the auto-focus-on-restore behaviour
* me.device.setAutoFocus(false);
*/
export declare function setAutoFocus(enable: boolean): void;
/**
* specify a function to execute when the Device is fully loaded and ready
* @param fn - the function to be executed
* @example
* // small game skeleton
* let game = {
* // called by the me.device.onReady function
* onload = function () {
* // init video
* if (!me.video.init('screen', 640, 480, true)) {
* alert("Sorry but your browser does not support html 5 canvas.");
* return;
* }
*
* // initialize the "audio"
* me.audio.init("mp3,ogg");
*
* // set callback for resources loaded event
* me.loader.onload = this.loaded.bind(this);
*
* // set all resources to be loaded
* me.loader.preload(game.assets);
*
* // load everything & display a loading screen
* me.state.change(me.state.LOADING);
* };
*
* // callback when everything is loaded
* loaded = function () {
* // define stuff
* // ....
*
* // change to the menu screen
* me.state.change(me.state.PLAY);
* }
* }; // game
*
* // "bootstrap"
* me.device.onReady(function () {
* game.onload();
* });
* @deprecated since 18.3.0 — no longer needed when using {@link Application} as entry point.
* @category Application
*/
export declare function onReady(fn: () => void): void;
/**
* Register blur/focus and visibility change event handlers.
* Called once during boot to emit BLUR/FOCUS events when the
* window or tab gains/loses focus.
* @ignore
*/
export declare function initVisibilityEvents(): void;
/**
* enable/disable swipe on WebView.
* @param [enable=true] - enable or disable swipe.
* @category Application
*/
export declare function enableSwipe(enable?: boolean): void;
export { exitFullscreen, requestFullscreen } from "../lang/deprecated.js";
/**
* Return a string representing the orientation of the device screen.
* It can be "any", "natural", "landscape", "portrait", "portrait-primary", "portrait-secondary", "landscape-primary", "landscape-secondary"
* @see https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation
* @returns the screen orientation
* @category Application
*/
export declare function getScreenOrientation(): string;
/**
* locks the device screen into the specified orientation.
* This method only works for installed Web apps or for Web pages in full-screen mode.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
* @param orientation - The orientation into which to lock the screen.
* @returns true if the orientation was unsuccessfully locked
* @category Application
*/
export declare function lockOrientation(orientation: string | string[]): boolean;
/**
* unlocks the device screen into the specified orientation.
* This method only works for installed Web apps or for Web pages in full-screen mode.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Screen/lockOrientation
* @returns true if the orientation was unsuccessfully unlocked
* @category Application
*/
export declare function unlockOrientation(): boolean;
/**
* return true if the device screen orientation is in Portrait mode
* @category Application
*/
export declare function isPortrait(): boolean;
/**
* return true if the device screen orientation is in Portrait mode
* @category Application
*/
export declare function isLandscape(): boolean;
/**
* return the device storage
* @see save
* @param [type="local"] - storage type (currently only `"local"` is supported)
* @returns a reference to the device storage
* @category Application
*/
export declare function getStorage(type?: string): Record;
/**
* return the parent DOM element for the given parent name or HTMLElement object
* @param element - the parent element name or a HTMLElement object
* @returns the parent Element
* @category Application
*/
export declare function getParentElement(element: string | HTMLElement): HTMLElement;
/**
* return the DOM element for the given element name or HTMLElement object
* @param element - the parent element name or a HTMLElement object
* @returns the corresponding DOM Element (falls back to `document.body` when the lookup fails or the input isn't an HTMLElement)
* @category Application
*/
export declare function getElement(element: string | HTMLElement): HTMLElement;
/**
* returns the size of the given HTMLElement and its position relative to the viewport
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRect
* @param element - an HTMLElement object
* @returns the size and position of the element relatively to the viewport
* @category Application
*/
export declare function getElementBounds(element: string | HTMLElement): DOMRect;
/**
* returns the size of the given HTMLElement Parent and its position relative to the viewport
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMRect
* @param element - an HTMLElement object
* @returns the size and position of the given element parent relative to the viewport
* @category Application
*/
export declare function getParentBounds(element: string | HTMLElement): DOMRect;
/**
* returns true if the device supports WebGL
* @param [options] - context creation options
* @param [options.failIfMajorPerformanceCaveat=true] - If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
* @returns true if WebGL is supported
* @category Application
*/
export declare function isWebGLSupported(options?: {
failIfMajorPerformanceCaveat?: boolean;
}): boolean;
/**
* Makes a request to bring this device window to the front.
* @example
* if (clicked) {
* me.device.focus();
* }
* @category Application
*/
export declare function focus(): void;
/**
* Enable monitor of the device accelerator to detect the amount of physical force of acceleration the device is receiving.
* (one some device a first user gesture will be required before calling this function)
* @see device.accelerationX
* @see device.accelerationY
* @see device.accelerationZ
* @see http://www.mobilexweb.com/samples/ball.html
* @see http://www.mobilexweb.com/blog/safari-ios-accelerometer-websockets-html5
* @returns false if not supported or permission not granted by the user
* @example
* // try to enable device accelerometer event on user gesture
* me.input.registerPointerEvent("pointerleave", app.viewport, function() {
* if (me.device.watchAccelerometer() === true) {
* // Success
* me.input.releasePointerEvent("pointerleave", app.viewport);
* } else {
* // ... fail at enabling the device accelerometer event
* }
* });
* @category Application
*/
export declare function watchAccelerometer(): boolean;
/**
* unwatch Accelerometer event
* @category Application
*/
export declare function unwatchAccelerometer(): void;
/**
* Enable monitor of the device orientation to detect the current orientation of the device as compared to the Earth coordinate frame.
* (one some device a first user gesture will be required before calling this function)
* @see device.alpha
* @see device.beta
* @see device.gamma
* @returns false if not supported or permission not granted by the user
* @example
* // try to enable device orientation event on user gesture
* me.input.registerPointerEvent("pointerleave", app.viewport, function() {
* if (me.device.watchDeviceOrientation() === true) {
* // Success
* me.input.releasePointerEvent("pointerleave", app.viewport);
* } else {
* // ... fail at enabling the device orientation event
* }
* });
* @category Application
*/
export declare function watchDeviceOrientation(): boolean;
/**
* unwatch Device orientation event
* @category Application
*/
export declare function unwatchDeviceOrientation(): void;
/**
* the vibrate method pulses the vibration hardware on the device,
* If the device doesn't support vibration, this method has no effect.
* If a vibration pattern is already in progress when this method is called,
* the previous pattern is halted and the new one begins instead.
* @param pattern - pattern of vibration and pause intervals
* @example
* // vibrate for 1000 ms
* me.device.vibrate(1000);
* // or alternatively
* me.device.vibrate([1000]);
* // vibrate for 50 ms, be still for 100 ms, and then vibrate for 150 ms:
* me.device.vibrate([50, 100, 150]);
* // cancel any existing vibrations
* me.device.vibrate(0);
* @category Application
*/
export declare function vibrate(pattern: number | number[]): void;
/**
* detect if the given video format is supported
* @param codec - the video format to check for support
* @returns return true if the given video format is supported
* @category Application
*/
export declare function hasVideoFormat(codec: "h264" | "h265" | "ogg" | "mp4" | "m4v" | "webm" | "vp9" | "hls"): boolean;
//# sourceMappingURL=device.d.ts.map