import IMessage from './IMessage'; import Video from './Video/Video'; import Stream from './Stream/Stream'; import Offline from './Offline/Offline'; import Command from './Command/Command'; import Hardware from './Hardware/Hardware'; import Browser from './Browser/Browser'; import Iframe from './Iframe/Iframe'; import Touch from './Touch/Touch'; import Input from './Input/Input'; import Debug from './Debug/Debug'; import DeviceInfo from './DeviceInfo/DeviceInfo'; import Display from './Display/Display'; import Timing from './Timing/Timing'; import Sync from './Sync/Sync'; import FileSystem from './FileSystem/FileSystem'; import Management from './Management/Management'; import Monitors from './Monitors/Monitors'; import Sensors from './Sensors/Sensors'; import OSD from './OSD/OSD'; import ProofOfPlay from './ProofOfPlay/ProofOfPlay'; import NativeCommands from './NativeCommands/NativeCommands'; import { WeinreData } from './Debug/IDebug'; import Connect from './Connect/Connect'; /** * The `sos` API groups together all functionality the \@signageos/front-applet offers. This is a basic object that provides you with access to * all the applet functionality, such as device information, display control, video playback, and more. * * :::warning * All calls to the sos object need to happen after `sos.onReady()` is resolved. After the sOS object is ready, there are global properties available, which can be used for applet customization and device identification. * ::: * * @example * // Simple example of using the sos API to play a video. * import sos from '@signageos/front-applet'; * * sos.onReady().then(async function () { * startYourApplet(); // Example method to run * // Any other code * } */ export default class FrontApplet { readonly window: Window & WeinreData; private messagePrefix; /** * The `config` property is a Key-value dictionary of the applet configuration. It is assigned on the device with timing via Box or SDK/Rest API. * * @since 1.5.0 * @example // {@link https://developers.signageos.io/docs/sos-guides/configuration/ | How to use configuration} */ readonly config: Record; /** * The `authHash` property is an alternative device identifier, which is designed for secure pairing and locating devices through * the REST API. * * 1. The `authHash` is commonly used as a link between the Applet deployed on the device and the device in device management. * 2. The `authHash` is unique and can be revoked upon request. * 3. The `authHash` can be used as a universal identifier for your Applet application. * * @since 1.0.0 * @tutorial https://developers.signageos.io/docs/sos-guides/device-identification */ readonly authHash: string; /** * The `appletVersion` is the version of the current applet. * * @since 4.5.0 * @example * sos.onReady().then(async function () { * console.log(sos.appletVersion); // e.g. "4.5.0" * }); */ readonly appletVersion: string; readonly apiJsUri: string | undefined; readonly debug: Debug; readonly deviceInfo: DeviceInfo; readonly display: Display; readonly stream: Stream; readonly video: Video; readonly command: Command; readonly hardware: Hardware; readonly offline: Offline; readonly browser: Browser; readonly iframe: Iframe; readonly touch: Touch; readonly input: Input; readonly timing: Timing; readonly sync: Sync; readonly fileSystem: FileSystem; readonly management: Management; readonly monitors: Monitors; readonly osd: OSD; readonly proofOfPlay: ProofOfPlay; readonly sensors: Sensors; readonly native: NativeCommands; readonly connect: Connect; private readyEmitter; private invocationResponseEmitter; private javascriptLoadFileController; /** @internal */ constructor(window: Window & WeinreData, messagePrefix: string); /** @internal */ postMessage(data: IMessage): Promise; /** * The `onReady()` method accepts an optional listener which is called after the sos API are loaded and ready. It also returns a promise * which is resolved at the same time as the listener. * * @param listener Optional listener which is called when the sos API is ready. * @return {Promise} Promise which is resolved when the sos API is ready. * @since 1.0.0 * * @example * sos.onReady().then(async function () { * console.log(await sos.app.getType()); * }); * * sos.onReady(async function () { * console.log(await sos.app.getType()); * }); */ onReady(listener?: () => void): Promise; /** * The `restore()` method clears all previously played videos, streams, clear display view. The typical case of usage for digital signage * is playing a loop with some specified duration. This method should be called always when the loop is changed. It will clear all * previously played videos, streams, clear display views, and notify for garbage collection. * * It stops all video playback and clears out the memory. The following function should be triggered only in a case the whole playback * needs to be restarted as it's completely switching the playback 'loop/playlist'. * * @example * sos.onReady(async function () { * // Some function which is called when the applet is ready * sos.restore(); * }); */ restore(): void; /** * The `refresh()` method initializes the refresh of the applet. Similar to window.location.reload(), but the applet is not downloaded again. * * @return {Promise} Promise that is resolved when the refresh is completed. * @since 1.0.0 * * @example * await sos.refresh(); */ refresh(): Promise; private forwardRestoreToFrontAppletWindows; private removeMediaListeners; private checkIfReady; private handleMessage; private getMessage; private startPinging; }