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

Merge pull request #875 from SuLG-ik/main-button-off-click-issue

Make MainButton.onClick(() -> Unit) and MainButton.offClick(() -> Unit) public
This commit is contained in:
InsanusMokrassar 2024-07-15 02:42:57 +06:00 committed by GitHub
commit 4343dbbde8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,8 +22,8 @@ external class MainButton {
fun showProgress(leaveActive: Boolean = definedExternally): MainButton fun showProgress(leaveActive: Boolean = definedExternally): MainButton
fun hideProgress(): MainButton fun hideProgress(): MainButton
internal fun onClick(eventHandler: () -> Unit): MainButton fun onClick(eventHandler: () -> Unit): MainButton
internal fun offClick(eventHandler: () -> Unit): MainButton fun offClick(eventHandler: () -> Unit): MainButton
internal fun setParams(params: Json): MainButton internal fun setParams(params: Json): MainButton
} }
@ -36,6 +36,7 @@ data class MainButtonParams(
val isVisible: Boolean? = null val isVisible: Boolean? = null
) )
@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()