UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

46 lines (45 loc) 1.95 kB
import { Context } from "./engine_setup.js"; export declare enum ApplicationEvents { Visible = "application-visible", Hidden = "application-hidden", MuteChanged = "application-mutechanged" } /** * Invoked when the user interacts with the page (click, touch, keypress, etc) allowing to play media / audio / start XR * @internal */ export declare function internalOnUserInputRegistered(): void; /** * The Application class can be used to mute audio globally, and to check if the application (canvas) is currently visible (it's tab is active and not minimized). */ export declare class Application extends EventTarget { static get userInteractionRegistered(): boolean; /** @deprecated use Application.registerWaitForInteraction instead */ static readonly registerWaitForAllowAudio: typeof Application.registerWaitForInteraction; /** * Register a callback that will be called when the user interacts with the page (click, touch, keypress, etc). * If the user has already interacted with the page, the callback will be called immediately. * This can be used to wait for user interaction before playing audio, for example. */ static registerWaitForInteraction(cb: Function): void; /** * Unregister a callback that was previously registered with registerWaitForInteraction. */ static unregisterWaitForInteraction(cb: Function): void; private _mute; /** audio muted? */ get muted(): boolean; /** set global audio mute */ set muted(value: boolean); private readonly context; /** @returns true if the document is focused */ get hasFocus(): boolean; /** * @returns true if the application is currently visible (it's tab is active and not minimized) */ get isVisible(): boolean; private _isVisible; /** @internal */ constructor(context: Context); private onVisiblityChanged; }