export class ModuleManager {
    static register(...modules) {
        for (let mod of modules) {
            if (mod.register) {
                mod.register();
            }
        }
        RegisterElementHelper.force();
    }
}
export let RegisterElementHelper = /*@__PURE__*/ (() => {
    class RegisterElementHelper {
        static registerElement(tagName, cons) {
            RegisterElementHelper._queue.push(() => {
                if (window.customElements) {
                    window.customElements.define(tagName, cons);
                }
                else {
                    document.registerElement(tagName, cons);
                }
            });
            RegisterElementHelper.queueUpdate();
        }
        static queueUpdate() {
            this._timerId = window.setTimeout(() => RegisterElementHelper.doUpdate(), 0);
        }
        static force() {
            if (this._timerId >= 0) {
                window.clearTimeout(this._timerId);
                this._timerId = -1;
            }
            this.doUpdate();
        }
        static doUpdate() {
            this._timerId = -1;
            this._updateQueued = false;
            while (RegisterElementHelper._queue.length > 0) {
                let ele = RegisterElementHelper._queue.shift();
                ele();
            }
        }
    }
    RegisterElementHelper._queue = [];
    RegisterElementHelper._updateQueued = false;
    RegisterElementHelper._timerId = -1;
    return RegisterElementHelper;
})();
//# sourceMappingURL=module-manager.js.map
