diff options
Diffstat (limited to 'src/utils/modal.tsx')
-rw-r--r-- | src/utils/modal.tsx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/modal.tsx b/src/utils/modal.tsx index 2affbd7..886e325 100644 --- a/src/utils/modal.tsx +++ b/src/utils/modal.tsx @@ -76,14 +76,26 @@ const ModalAPI = mapMangledModuleLazy("onCloseRequest:null!=", { openModalLazy: m => m?.length === 1 && filters.byCode(".apply(this,arguments)")(m), }); +/** + * Wait for the render promise to resolve, then open a modal with it. + * This is equivalent to render().then(openModal) + * You should use the Modal components exported by this file + */ export function openModalLazy(render: () => Promise<RenderFunction>, options?: ModalOptions & { contextKey?: string; }): Promise<string> { return ModalAPI.openModalLazy(render, options); } +/** + * Open a Modal with the given render function. + * You should use the Modal components exported by this file + */ export function openModal(render: RenderFunction, options?: ModalOptions, contextKey?: string): string { return ModalAPI.openModal(render, options, contextKey); } +/** + * Close a modal by its key + */ export function closeModal(modalKey: string, contextKey?: string): void { return ModalAPI.closeModal(modalKey, contextKey); } |