Skip to content

Instantly share code, notes, and snippets.

@ShikaSD
Created July 26, 2020 20:25
Show Gist options
  • Save ShikaSD/1674d5028e3f7506bc0b52a5c3340929 to your computer and use it in GitHub Desktop.
Save ShikaSD/1674d5028e3f7506bc0b52a5c3340929 to your computer and use it in GitHub Desktop.
private val CommandDispatcherAmbient = staticAmbientOf<RenderCommandDispatcher>()
// Instantiate it
composition.setContent {
Providers(CommandDispatcherAmbient provides commandDispatcher) {
composable()
}
}
// Use it
@Composable
fun tag(
tagName: String,
children: @Composable() () -> Unit
) {
val renderCommandDispatcher = CommandDispatcherAmbient.current
emit<HtmlNode.Tag, ServerApplyAdapter>(
ctor = { HtmlNode.Tag(renderCommandDispatcher, tagName) },
update = { },
children = children
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment