fleeta-api-lib
Version:
A comprehensive library for fleet management applications - API, Auth, Device management
77 lines • 1.99 kB
TypeScript
/**
* Generic SDK Loader Interface and Implementation
* Provides a reusable SDK loading mechanism
*/
export interface ISDKLoader {
isLoaded(): boolean;
isLoading(): boolean;
getError(): string | null;
loadSDK(): Promise<void>;
reset(): void;
}
/**
* Generic SDK loader configuration
*/
export interface SDKLoaderConfig {
sdkUrl: string;
globalObjectName: string;
loadTimeout?: number;
}
/**
* Generic SDK loader class for managing external SDK loading
*/
export declare class GenericSDKLoader implements ISDKLoader {
private static instances;
private static globalLoadPromise;
private config;
private state;
private loadPromise;
/**
* Get or create singleton instance for a specific SDK
*/
static getInstance(config: SDKLoaderConfig): GenericSDKLoader;
/**
* Preload SDK globally (call once at app startup)
* This ensures SDK is ready before any connections are needed
*/
static preloadGlobalSDK(config: SDKLoaderConfig): Promise<void>;
/**
* Check if SDK is globally available (faster than instance check)
*/
static isGloballyLoaded(globalObjectName: string): boolean;
/**
* Private constructor - use getInstance instead
*/
private constructor();
/**
* Check if SDK is loaded
*/
isLoaded(): boolean;
/**
* Check if SDK is currently loading
*/
isLoading(): boolean;
/**
* Get loading error if any
*/
getError(): string | null;
/**
* Load SDK
* Returns a promise that resolves when SDK is loaded
*/
loadSDK(): Promise<void>;
/**
* Perform actual SDK loading
*/
private performSDKLoad;
/**
* Reset SDK loader state
* Useful for testing or forcing reload
*/
reset(): void;
}
/**
* Convenience function to create WebRTC SDK loader
*/
export declare function createWebRTCSDKLoader(): GenericSDKLoader;
//# sourceMappingURL=SDKLoader.d.ts.map