function hideDialog()

in src/modules/sim-host/dialog.js [50:93]


function hideDialog(dialogId) {
    if (!dialogId) {
        dialogId = currentDialogId;
        if (!dialogId) {
            throw 'Trying to hide dialog when none is showing.';
        }
    } else {
        if (dialogId !== currentDialogId) {
            throw 'Trying to hide a dialog that isn\'t currently showing: ' + dialogId;
        }
    }

    var dialog = pluginDialogs[dialogId];
    if (!dialog) {
        throw 'No dialog defined with id ' + dialogId;
    }

    currentDialogId = null;
    dialog.hide();

    // After a timeout, see if there are more dialogs to show
    window.setTimeout(function () {
        if (currentDialogId) {
            return;
        }

        var dialogInfo = findNextDialog();
        if (dialogInfo) {
            showDialog(dialogInfo.id, dialogInfo.callback);
        } else {
            // No dialog to show? Re-enable the panels
            getPanels().forEach(function (panel) {
                panel.enabled = true;
            });

            if (activeElement) {
                activeElement.focus();
                activeElement = null;
            }

            panelsDisabled = false;
        }
    }, 0);
}