mframejs
Version:
simple framework
29 lines (22 loc) • 835 B
text/typescript
import { ContainerClasses } from '../container/exported';
import { MF } from './mf';
import { IElement } from '../interface/exported';
import { DOM } from './dom';
/**
* configure function, used to start the framework
* You pass in node you want it to attach to and app instance
*
*/
export async function configure(app: any): Promise<any> {
const miniFramework: MF = ContainerClasses.get(MF);
const rootApp: IElement = ContainerClasses.get(app);
if (DOM.document.body === null) {
return new Promise((resolve: any) => {
DOM.document.addEventListener('DOMContentLoaded', function () {
resolve((miniFramework as MF).setRootApp(rootApp));
});
});
} else {
return await (miniFramework as MF).setRootApp(rootApp);
}
}