diff options
author | Vendicated <vendicated@riseup.net> | 2022-11-25 19:25:35 +0100 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-11-25 19:25:35 +0100 |
commit | a85ec594a77557e5f48c4cf1aa33680e0da94654 (patch) | |
tree | e88fa38f588fef187a0caec884763fc50da8385d /src/utils/modal.tsx | |
parent | c2c6c9fccb3b94340037d2136d647817d0a1c916 (diff) | |
download | Vencord-a85ec594a77557e5f48c4cf1aa33680e0da94654.tar.gz Vencord-a85ec594a77557e5f48c4cf1aa33680e0da94654.tar.bz2 Vencord-a85ec594a77557e5f48c4cf1aa33680e0da94654.zip |
[skip ci] docs docs docs
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); } |