aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Widget.kt18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
index b74352d3..918d0ad0 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
@@ -262,14 +262,18 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent(), Component
* @return list of event handlers
*/
protected open fun getSnOn(): com.github.snabbdom.On? {
- val map = listenersMap.filter { it.key != "self" && it.value.isNotEmpty() }.toMutableMap()
- internalListenersMap.filter { it.key != "self" && it.value.isNotEmpty() }
- .forEach { (event, internalListeners) ->
- val listeners = map[event]
- if (listeners != null) {
- listeners.putAll(internalListeners)
+ val map = internalListenersMap.filter { it.key != "self" && it.value.isNotEmpty() }.map {
+ val internalListeners = mutableMapOf<Int, SnOn<Widget>.() -> Unit>()
+ internalListeners.putAll(it.value)
+ it.key to internalListeners
+ }.toMap().toMutableMap()
+ listenersMap.filter { it.key != "self" && it.value.isNotEmpty() }
+ .forEach { (event, listeners) ->
+ val internalListeners = map[event]
+ if (internalListeners != null) {
+ internalListeners.putAll(listeners)
} else {
- map[event] = internalListeners
+ map[event] = listeners
}
}
return if (map.isNotEmpty()) {