UNPKG

@synerty/vortexjs

Version:

Custom observable data serialisation and routing based on Angular 2+

57 lines (56 loc) 2.1 kB
import { NgZone } from "@angular/core"; import { Observable, Subject } from "rxjs"; import * as i0 from "@angular/core"; export interface VortexStatusServiceSnapshot { isOnline: boolean; queuedActionCount: number; } /** * Enum representing the different states of the Vortex application. * Disabled: The vortex if offline and disconnected * Reconnecting: The vortex is not online, but is in the reconnecting state * machine. * Online: The websocket is online and connected * NoNetwork: The network is offline * NetworkOnlineNoWebsocketResource: * The HTTP service is online, but not serving * the websocket upgrades. * This usually means the service is logged out. */ export declare enum VortexStateEnum { Disabled = 1, Reconnecting = 2, Online = 3, NoNetwork = 4, NetworkOnlineNoWebsocketResource = 5 } export declare class VortexStatusService { private zone; private readonly _websocketState$; private readonly _isOnline$; readonly debug: Subject<string>; readonly info: Subject<string>; readonly warning: Subject<string>; readonly errors: Subject<string>; readonly connectionInfo: Subject<string>; readonly connectionError: Subject<string>; constructor(zone: NgZone); get snapshot(): VortexStatusServiceSnapshot; get websocketState(): VortexStateEnum; get websocketStateObservable(): Observable<VortexStateEnum>; get isOnline(): Observable<boolean>; setVortexState(state: VortexStateEnum): void; queuedActionCount: Subject<number>; lastQueuedTupleActions: number; incrementQueuedActionCount(): void; decrementQueuedActionCount(): void; setQueuedActionCount(count: number): void; logDebug(message: string): void; logInfo(message: string): void; logWarning(message: string): void; logError(message: string): void; logConnectionInfo(message: string): void; logConnectionError(message: string): void; static ɵfac: i0.ɵɵFactoryDeclaration<VortexStatusService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<VortexStatusService>; }