All files / mframejs/utils configure.ts

70% Statements 7/10
100% Branches 0/0
0% Functions 0/2
70% Lines 7/10

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 2929x 29x   29x               29x   15x 15x                 15x          
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);
    }
 
 
}