Created
July 26, 2020 20:25
-
-
Save ShikaSD/1674d5028e3f7506bc0b52a5c3340929 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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