1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-08 09:23:47 +00:00

small refactor of MainButton

This commit is contained in:
InsanusMokrassar 2024-07-15 02:45:01 +06:00
parent 4343dbbde8
commit 4ce26c707e

View File

@ -22,6 +22,9 @@ external class MainButton {
fun showProgress(leaveActive: Boolean = definedExternally): MainButton fun showProgress(leaveActive: Boolean = definedExternally): MainButton
fun hideProgress(): MainButton fun hideProgress(): MainButton
/**
* **This method argument do not accept `this` [WebApp] object**
*/
fun onClick(eventHandler: () -> Unit): MainButton fun onClick(eventHandler: () -> Unit): MainButton
fun offClick(eventHandler: () -> Unit): MainButton fun offClick(eventHandler: () -> Unit): MainButton
@ -36,7 +39,7 @@ data class MainButtonParams(
val isVisible: Boolean? = null val isVisible: Boolean? = null
) )
@Deprecated(message="Use onClick without EventHandler") @Deprecated(message = "Use onClick without EventHandler")
fun MainButton.onClick(eventHandler: EventHandler) = onClick { fun MainButton.onClick(eventHandler: EventHandler) = onClick {
val that = js("this").unsafeCast<WebApp>() val that = js("this").unsafeCast<WebApp>()
that.eventHandler() that.eventHandler()