import Worker from 'worker-loader?inline!../worker/Worker'; import { ConnectionStatusPayload, EventMessagePayload, WorkerMessage } from '../worker/types/WorkerMessage'; import { LogLevel } from '../utils/Logger'; import EventTypes from '../events/enums/EventTypes'; import ConnectionDiagnostic from '../diagnostic/ConnectionDiagnostic'; import { ExternalConfig } from './WebXPanelConfigParams'; export default class WebXPanel { private static instance; private _worker; private tokenUrl; private websocketToken; private _reconnectTimeout; private readonly _connectionDiagnostic; private constructor(); set reconnectTimeout(data: number); get reconnectTimeout(): number; get worker(): Worker; get connectionDiagnostic(): ConnectionDiagnostic; static getInstance(): WebXPanel; initialize(config: Partial): void; private static externalToInternalConfigParams; authenticate(): void; static enableDebugging(): void; static disableDebugging(): void; static getDebugging(): boolean; static getLogLevel(): LogLevel; static setLogLevel(logLevel: LogLevel): void; addEventListener(event: EventTypes, callback: EventListener): void; private addCommunicationMethodsToWindow; private initializeWorker; private getJwtToken; setBasePathOnWorker(): void; connectToWebSocketServer(): void; private updateLoggerState; private initializeWebSocketClient; /** * This method is called whenever a postMessage is sent from the worker thread. * @param messageEvent */ private static onWorkerMessage; /** * Method used to process the incoming messages from the worker thread */ private static processWorkerMessage; private static handleInternalEvent; /** * @see https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value */ private increaseReconnectTimeout; /** * Method used to process the websocket messages */ private static processWebSocketMessages; static processDiagnosticsMessages(workerMessage: WorkerMessage): void; static processValidationEvents(workerMessage: WorkerMessage): void; /** * This method is called whenever an ErrorEvent bubbles through to the worker. * @param event */ private static onWorkerError; /** * This method is called whenever a message that can't be deserialized is received. * @param event */ private static onWorkerMessageError; private bindWorkerListeners; private initializeConnectionDiagnostic; }