aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Widget.kt5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
index c03316ab..a1d37541 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Widget.kt
@@ -111,6 +111,9 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent(), Component
protected var lastLanguage: String? = null
+ var afterInsertHook: ((VNode) -> Unit)? = null
+ var afterDestroyHook: (() -> Unit)? = null
+
protected fun <T> singleRender(block: () -> T): T {
getRoot()?.renderDisabled = true
val t = block()
@@ -630,6 +633,7 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent(), Component
content = it.content?.let { translate(it) }).toJs()
)
}
+ this.afterInsertHook?.invoke(node)
}
/**
@@ -651,6 +655,7 @@ open class Widget(classes: Set<String> = setOf()) : StyledComponent(), Component
val popoverFun = getElementJQueryD()?.popover
if (popoverFun != undefined) getElementJQueryD()?.popover("dispose")
}
+ this.afterDestroyHook?.invoke()
}
/**