window.mcInitializers = {};
window.addMCInitializer = function(_name, _func, _container) {
    if(!!window.mcInitializers[_name]) {
        // console.warn('ALIX initializer ' + _name + ' exists. Will overwrite.');
        delete window.mcInitializers[_name];
    }
    window.mcInitializers[_name] = {
        func: _func,
        container: _container
    };
};
window.runMCInitializers = function() {
    if(!!mcInitializers) {
        // console.log('ALIX -----------------');
        for(let initer in mcInitializers) {
            if(mcInitializers.hasOwnProperty(initer)) {
                try {
                    let initerObj = mcInitializers[initer];
                    if(!initerObj.container || $(initerObj.container).length) {
                        // console.log("ALIX running MC initer", initer);
                        initerObj.func();
                    }
                    else {
                        // console.warn("ALIX MC initer not in context. Removing ", initer);
                        delete mcInitializers[initer];
                        initerObj = null;
                    }
                }
                catch(e) {
                    console.warn('MC init error: ', e);
                    console.warn('Initer: ', initer);
                }
            }
        }
    }
};
