aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/snabbdom
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/snabbdom')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/snabbdom/Types.kt22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/snabbdom/Types.kt b/src/main/kotlin/pl/treksoft/kvision/snabbdom/Types.kt
index 3bf68003..8a292910 100644
--- a/src/main/kotlin/pl/treksoft/kvision/snabbdom/Types.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/snabbdom/Types.kt
@@ -2,11 +2,15 @@ package pl.treksoft.kvision.snabbdom
import com.github.snabbdom.Attrs
import com.github.snabbdom.Classes
+import com.github.snabbdom.Hooks
import com.github.snabbdom.On
import com.github.snabbdom.Props
import com.github.snabbdom.VNodeData
import com.github.snabbdom.VNodeStyle
+import org.w3c.dom.CustomEvent
+import org.w3c.dom.CustomEventInit
import pl.treksoft.kvision.core.Widget
+import pl.treksoft.kvision.html.Button
external class Object
@@ -17,7 +21,18 @@ fun obj(init: dynamic.() -> Unit): dynamic {
@Suppress("UnsafeCastFromDynamic")
private fun vNodeData(): VNodeData = js("({})")
-interface SnOn<T> : On {
+class DropDownEvent(type: String, eventInitDict: CustomEventInit) : CustomEvent(type, eventInitDict) {
+ override val detail: Button? = null
+}
+
+interface BtOn : On {
+ var showBsDropdown: ((DropDownEvent) -> kotlin.Unit)?
+ var shownBsDropdown: ((DropDownEvent) -> kotlin.Unit)?
+ var hideBsDropdown: ((DropDownEvent) -> kotlin.Unit)?
+ var hiddenBsDropdown: ((DropDownEvent) -> kotlin.Unit)?
+}
+
+interface SnOn<T> : BtOn {
var self: T
}
@@ -30,6 +45,11 @@ internal fun on(widget: Widget): SnOn<Widget> {
return obj
}
+@Suppress("UnsafeCastFromDynamic")
+internal fun hooks(): Hooks {
+ return js("({})")
+}
+
typealias StringPair = Pair<String, String>
typealias StringBoolPair = Pair<String, Boolean>