@foxpage/foxpage-manager
Version:
foxpage resource manager
46 lines (45 loc) • 1.32 kB
TypeScript
import { Application, FoxRoute, ManagerOption } from '@foxpage/foxpage-types';
import { ManagerImpl } from './manager';
/**
* init resource manager
* its singleton
* @param opt init manager options
* @example const opt = {
apps: [{ appId: '1000', appName: 'app name', options: {} }],
dataService: { host: '', path: '' },
} as ManagerOption;
* @returns {ManagerImpl}
*/
export declare const initManager: (opt: ManagerOption) => Promise<ManagerImpl>;
/**
* get manager
* @returns Manager
*/
export declare const getManager: () => ManagerImpl | null;
/**
* get application via appId
* @param appId application appId
* @returns Application|undefined
*/
export declare const getApplication: (appId: string) => Application | undefined;
/**
* get appList
* @param appIds
* @returns Application[]
*/
export declare const getApplications: (appIds?: string[]) => Application[];
/**
* get application via appName
* @param slug application slug
* @returns Application|undefined
*/
export declare const getApplicationBySlug: (slug: string) => Application | undefined;
/**
* get application via path
* @param path user request path
* @returns Application|undefined
*/
export declare const getApplicationByPath: (path: string) => {
app: Application;
matchedRoute?: FoxRoute;
} | undefined;