mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-11-22 16:23:54 +00:00
add toggle closing confirmation button
This commit is contained in:
parent
7e9968ced9
commit
0c5186a37d
@ -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}")
|
||||
|
Loading…
Reference in New Issue
Block a user