UNPKG

magicbean-saas-common

Version:

MagicBean SasS Common Components

28 lines (22 loc) 686 B
import { Modal } from "bootstrap"; const hideModal = (modalEl: HTMLElement | null): void => { if (!modalEl) { return; } const myModal = Modal.getInstance(modalEl); myModal.hide(); }; const modalHideListener = (modalEl: HTMLElement | null, callback): void => { if (!modalEl) { return; } modalEl.addEventListener("hide.bs.modal", callback); }; const removeModalBackdrop = (): void => { if (document.querySelectorAll(".modal-backdrop.fade.show").length) { document.querySelectorAll(".modal-backdrop.fade.show").forEach((item) => { item.remove(); }); } }; export { removeModalBackdrop, hideModal, modalHideListener };