Class: ModalService
Defined in: workingtitle-instruments-epic2/shared/Modals/ModalService.tsx:17
Stores, hides, and reveals modals.
Constructors
Constructor
new ModalService(
container
):ModalService
Defined in: workingtitle-instruments-epic2/shared/Modals/ModalService.tsx:24
ctor
Parameters
Parameter | Type | Description |
---|---|---|
container | HTMLElement | The element to put modals in. |
Returns
ModalService
Methods
close()
close(
key
):void
Defined in: workingtitle-instruments-epic2/shared/Modals/ModalService.tsx:79
Hides a modal by key, and calls its onPause method.
Parameters
Parameter | Type | Description |
---|---|---|
key | ModalKey | The modal to close. |
Returns
void
Throws
error if modal doesn't exist.
closeByRef()
closeByRef(
modal
):void
Defined in: workingtitle-instruments-epic2/shared/Modals/ModalService.tsx:95
Hides a modal by reference, and calls its onPause method. Only meant to be used by the Modal itself.
Parameters
Parameter | Type | Description |
---|---|---|
modal | Modal | The modal to close. |
Returns
void
closeModalsInPosition()
closeModalsInPosition(
position
):void
Defined in: workingtitle-instruments-epic2/shared/Modals/ModalService.tsx:66
Closes any open modals that are in the specified position
Parameters
Parameter | Type | Description |
---|---|---|
position | ModalPosition | The position |
Returns
void
open()
open<
M
>(key
):ModalEntry
<M
>
Defined in: workingtitle-instruments-epic2/shared/Modals/ModalService.tsx:50
Opens a modal and calls its onResume method.
Type Parameters
Type Parameter | Default type |
---|---|
M extends Modal <ModalProps > | Modal <ModalProps > |
Parameters
Parameter | Type | Description |
---|---|---|
key | ModalKey | The modal key to open. |
Returns
ModalEntry
<M
>
An object containing the modal instance.
Throws
error if modal doesn't exist.
registerModal()
registerModal(
key
,position
,modalBuilder
):void
Defined in: workingtitle-instruments-epic2/shared/Modals/ModalService.tsx:32
Registers a modal with a key.
Parameters
Parameter | Type | Description |
---|---|---|
key | ModalKey | The modal key. |
position | ModalPosition | The position of the modal |
modalBuilder | () => VNode | A function returning a Modal VNode. |
Returns
void