import {isMobile} from "../util/functions"; import {Dialog} from "./index"; export const confirmDialog = (title: string, text: string, confirm?: () => void, cancel?: () => void) => { const dialog = new Dialog({ title, content: `
${text}
`, width: isMobile() ? "92vw" : "520px", }); const btnsElement = dialog.element.querySelectorAll(".b3-button"); btnsElement[0].addEventListener("click", () => { if (cancel) { cancel(); } dialog.destroy(); }); btnsElement[1].addEventListener("click", () => { if (confirm) { confirm(); } dialog.destroy(); }); };