diff options
author | Robert Jaros <rjaros@finn.pl> | 2020-03-27 18:29:00 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2020-03-27 18:29:00 +0100 |
commit | ddaa99a3ff9e502a67d11c5aca549a843cd1c3d7 (patch) | |
tree | 21f7838097b53ba4977e2b38e272d5ec35d710c8 /src/main/kotlin | |
parent | e403cb447ec5a088439c75ff547c2c4dcab95928 (diff) | |
download | kvision-ddaa99a3ff9e502a67d11c5aca549a843cd1c3d7.tar.gz kvision-ddaa99a3ff9e502a67d11c5aca549a843cd1c3d7.tar.bz2 kvision-ddaa99a3ff9e502a67d11c5aca549a843cd1c3d7.zip |
Add hooks to allow direct access to afterInsert and afterDestroy callbacks
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/core/Widget.kt | 5 |
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() } /** |