add toggle closing confirmation button

This commit is contained in:
InsanusMokrassar 2022-08-15 01:28:42 +06:00
parent 7e9968ced9
commit 0c5186a37d
1 changed files with 17 additions and 0 deletions

View File

@ -125,6 +125,23 @@ fun main() {
document.body ?.appendElement("p", {})
document.body ?.appendElement("button") {
fun updateText() {
textContent = if (webApp.isClosingConfirmationEnabled) {
"Disable closing confirmation"
} else {
"Enable closing confirmation"
}
}
addEventListener("click", {
webApp.toggleClosingConfirmation()
updateText()
})
updateText()
} ?: window.alert("Unable to load body")
document.body ?.appendElement("p", {})
webApp.apply {
onThemeChanged {
document.body ?.log("Theme changed: ${webApp.themeParams}")