UNPKG

loadax

Version:

Universal powerful solution for creating web app

97 lines (96 loc) 3.7 kB
export declare const LOADAX_RESTORE_ACTION = "LOADAX_RESTORE_ACTION"; export declare const LOADAX_UST_REGISTER = "LOADAX_UST_REGISTER"; export declare enum ModuleType { instance = 0, page = 1, lib = 2, component = 3 } export declare type ModuleBase = { name: string; path: string; version: string; type: ModuleType; pageRoute: string; childrenRoutes: string[]; css: string; }; export declare type ModuleInstance = { module: string; }; export declare type ModuleRoute = { url: string; name: string; children: string[]; }; export declare type LoadedModuleBase = ModuleBase & ModuleInstance; export declare type LoadaxStore = { name: string; value: any; }; export declare type PwaConfig = { app: (context: ServiceWorkerRegistration) => void; store: LoadaxStore[]; asInstance?: boolean; url?: string; }; export declare type StoreManagerSync = { namespace: string; }; export declare type StoreManagerPayload<T = any> = { namespace: string; payload: T; }; export declare class ModuleLoader<MB extends ModuleBase = ModuleBase, LMB extends LoadedModuleBase = LoadedModuleBase> { static isInstance: boolean; isInstance: boolean; static StoreFloatContext: ServiceWorkerRegistration["active"]; static floatModules: any[]; static floatLoadedModules: any[]; StoreFloatContext: ServiceWorkerRegistration["active"]; activeModules: MB[]; loadedModules: LMB[]; baseApi: string; constructor(apiUrl: string); storeAction<T>(value: StoreManagerPayload<T>): void; static storeAction<T>(value: StoreManagerPayload<T>): void; storeActionScope(value: StoreManagerPayload[]): void; static storeActionScope(value: StoreManagerPayload[]): void; storeSync(): void; static storeSync(): void; static clearUTS(): void; private isNotRegisteredUST; private static isNotRegisteredUST; private registerUST; private static registerUST; storeEmit(emit: (store: MessageEvent["data"]) => void, _ust?: string): void; static storeEmit(emit: (store: MessageEvent["data"]) => void, _ust?: string): void; private setStoreContext; static setStoreContext(store: ServiceWorkerRegistration["active"]): void; private findLoadedModule; private static findLoadedFloatModule; private moduleIsNotExist; private static floatModuleIsNotExist; private findModule; private static findFloatModule; private getModules; private static getFloatModules; getModule(name: string): Promise<void>; static getFloatModule(module: LoadedModuleBase): Promise<void>; static getFloatStaticModule<LMB extends LoadedModuleBase = LoadedModuleBase>(moduleUrl: string): Promise<void>; getStaticModule(module: MB): Promise<void>; static getStaticFloatModule<MB extends ModuleBase = ModuleBase>(module: MB): Promise<void>; injectAllStaticModules(): Promise<LMB[]>; injectAllModules(): Promise<LMB[]>; static injectFloatModules<T extends ModuleBase = ModuleBase>(apiUrl: string): Promise<T[]>; getAppComponent(name: string): LMB | undefined; getAppLib(name: string): LMB | undefined; injectModule(name: string): Promise<LMB | undefined>; static injectFloatModule<LMB extends LoadedModuleBase = LoadedModuleBase>(name: string, moduleUrl: string): Promise<LMB | undefined>; executeModule(name: string): void; static executeFloatModule(name: string): void; asPwa(pwa: PwaConfig): Promise<void>; static asPwa(pwa: PwaConfig): Promise<void>; static asInstance(): void; asInstance(): void; }