loadax
Version:
Universal powerful solution for creating web app
53 lines (52 loc) • 1.85 kB
TypeScript
export declare type MicroModule = {
type: number;
name: string;
routes: string[];
js: string;
css: string;
version?: string;
};
export declare type ReadyMicroModule = {
name: string;
js: string;
css: string;
type: number;
};
export declare type MicroModuleLib = {
name: string;
payload: string;
};
export declare type IBridge = {
channel: ServiceWorkerRegistration | null;
provide<T = any>(command: string, value?: T): void;
connect(init: (ctx: ServiceWorkerRegistration) => void, sw: string): any;
consume(command: string, action: (value: any) => void): void;
};
export declare type IMicro = {
libs: MicroModuleLib[];
modules: MicroModule[];
readyModules: ReadyMicroModule[];
load(url: string): Promise<MicroModule[]>;
register(name: string): void;
execute(name: string): void;
injectModule(module: MicroModule | ReadyMicroModule): Promise<void>;
};
declare const Loadax: {
injectModules(url: string): Promise<MicroModule[]>;
executeModule(module: MicroModule | ReadyMicroModule): Promise<void>;
asPwa(init: (ctx: ServiceWorkerRegistration) => void, sw?: string): any;
send<T = any>(command: string, value: T): void;
listen(command: string, action: (value: any) => void): void;
};
export declare const LoadaxJsx: (tagName: any, attrs?: {
[k: string]: any;
}, ...children: any) => any;
export declare const CreateApp: (node: string, component: Node) => void;
export declare const Context: <T = any>(data: T, components?: any[]) => {
data: T;
set(obj: {}): void;
update(obj: {}): void;
};
export declare const Before: (action: (it: any) => void, component: any) => void;
export declare const After: (action: () => void, component: any) => void;
export default Loadax;