Class used to manage modal state.

Accessible on the app object via app.modal property.

Hierarchy

  • ModalManagerState

Constructors

Properties

Methods

Constructors

Properties

backdropShown: boolean = false
key: number = 0

Used to force re-initialization of modals if a modal is replaced by another of the same type.

modal: null | ModalItem = null
modalList: ModalItem[] = []

Methods

  • Shows a modal dialog.

    If stackModal is true, the modal will be shown on top of the current modal.

    If a value for stackModal is not provided, opening a new modal will close any others currently being shown for backwards compatibility.

    Example

    Show a modal

    app.modal.show(MyCoolModal, { attr: 'value' });
    

    Example

    Show a modal from a lifecycle method (`oncreate`, `view`, etc.) // This "hack" is needed due to quirks with nested redraws in Mithril. setTimeout(() => app.modal.show(MyCoolModal, { attr: 'value' }), 0);

    Example

    Stacking modals

    app.modal.show(MyCoolStackedModal, { attr: 'value' }, true);
    

    Parameters

    • componentClass: UnsafeModalClass
    • attrs: Record<string, unknown> = {}
    • stackModal: boolean = false

    Returns void

Generated using TypeDoc v0.23.24