Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 18x 18x 18x 18x 18x 18x 18x 80x 80x 80x 80x 80x 80x 80x 80x 80x 80x 76x | import { InitOptions } from 'i18next';
import { Config, IConfig } from './config';
import { Http } from './http';
import { I18n } from './i18n';
import { IControllerBuilder, Loader, SimpleControllerBuilder } from './loader';
import { Router } from './router';
import { IDictionary, INewable } from './utils';
const appController = 'AppController';
export interface IZeedhiOptions {
config?: IConfig;
controllers?: IDictionary<INewable<any>>;
controllerBuilder?: IControllerBuilder;
i18n?: InitOptions;
router?: any;
}
export function init(options: IZeedhiOptions = {}) {
Config.set(options.config || {});
Http.setBaseURL(Config.endPoint);
Loader.setControllers(options.controllers || {});
const controllerBuilder = options.controllerBuilder || new SimpleControllerBuilder();
Loader.setBuilder(controllerBuilder);
I18n.init(options.i18n);
Router.setInstance(options.router);
callInitProjectCallback();
}
function callInitProjectCallback() {
const appCtrl = Loader.getInstance(appController);
if (appCtrl?.onInit instanceof Function) {
appCtrl.onInit();
}
}
|