From f377ebea888654d4737eeed71b84843057313942 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 17 Mar 2022 19:16:31 +0600 Subject: [PATCH] add renderComposableAndLinkToRoot --- .../common/compose/RenderComposableAndLinkToRoot.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 common/compose/src/jsMain/kotlin/dev/inmo/micro_utils/common/compose/RenderComposableAndLinkToRoot.kt diff --git a/common/compose/src/jsMain/kotlin/dev/inmo/micro_utils/common/compose/RenderComposableAndLinkToRoot.kt b/common/compose/src/jsMain/kotlin/dev/inmo/micro_utils/common/compose/RenderComposableAndLinkToRoot.kt new file mode 100644 index 00000000000..3b1c6be3a37 --- /dev/null +++ b/common/compose/src/jsMain/kotlin/dev/inmo/micro_utils/common/compose/RenderComposableAndLinkToRoot.kt @@ -0,0 +1,13 @@ +package dev.inmo.micro_utils.common.compose + +import androidx.compose.runtime.* +import org.jetbrains.compose.web.dom.DOMScope +import org.w3c.dom.Element + +fun renderComposableAndLinkToRoot( + root: TElement, + monotonicFrameClock: MonotonicFrameClock = DefaultMonotonicFrameClock, + content: @Composable DOMScope.() -> Unit +): Composition = org.jetbrains.compose.web.renderComposable(root, monotonicFrameClock, content).apply { + linkWithElement(root) +}