web-gambit
Version:
Micro front-end library
60 lines (59 loc) • 1.96 kB
TypeScript
declare global {
interface Window {
_$$wgb: {
modules: {
[t: string]: {
[t: string]: any;
};
};
root: boolean;
sync: {
[t: string]: any;
};
state: {
[t: string]: any;
};
};
}
}
export declare type IRoute = {
path: string;
name: string;
props: {
[t: string]: string;
};
component: Function;
active?: boolean;
};
declare type IListen = {
name: string;
command: string;
action: (value: any) => void;
};
export declare function executeModule(module: string): any;
export declare function executeUmdModule(code: string): any;
export declare function ChangeLimit(limit: string): void;
export declare function AppKey(): string[];
export declare function Module<T = any>({ moduleName, moduleState }: {
moduleName: string;
moduleState: T;
}, initial: () => void): void;
export declare function Emit(command: string, value: any): void;
export declare function Watch(data: IListen): void;
export declare function importModule(url: string, init?: RequestInit): Promise<string>;
export declare function importStyleModule(name: string, url: string, prefix?: string): void;
export declare function Context<T = any>({ id, data }: {
id: string;
data: T;
}): {
state: T;
setState: (v: T) => void;
};
export declare function CreateApp(component: any, target: HTMLElement): void;
export declare function createJsx(tagName: string | Function, props?: {}, ...children: any): any;
export declare function loadFMM(liString: string): string;
export declare function ToRoute(path: IRoute["path"]): void;
export declare function CurrentRoute(): IRoute;
export declare function PrevRoute(): IRoute;
export declare function CreateRouter(Routes: IRoute[]): any;
export {};