diff options
| author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-04-06 15:58:55 +0200 |
|---|---|---|
| committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-04-22 13:10:48 +0200 |
| commit | 720c50fb7f4bf4ae4b4d4c406cfb958a7fba8ffb (patch) | |
| tree | 10869d6dcbd5af8599b2091fc6581ce6b16a47d5 /plugins/base/src/main/kotlin/renderers/html | |
| parent | 58126c324c30fff4f65fef7cc72aa715364ef358 (diff) | |
| download | dokka-720c50fb7f4bf4ae4b4d4c406cfb958a7fba8ffb.tar.gz dokka-720c50fb7f4bf4ae4b4d4c406cfb958a7fba8ffb.tar.bz2 dokka-720c50fb7f4bf4ae4b4d4c406cfb958a7fba8ffb.zip | |
Adds asynchronous rendering
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html')
| -rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index bbb5b685..a32cb715 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -1,5 +1,9 @@ package org.jetbrains.dokka.base.renderers.html +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch import kotlinx.html.* import kotlinx.html.stream.createHTML import org.jetbrains.dokka.base.DokkaBase @@ -264,7 +268,7 @@ open class HtmlRenderer( } } - override fun renderPage(page: PageNode) { + override suspend fun renderPage(page: PageNode) { super.renderPage(page) if (page is ContentPage) { pageList.add( @@ -282,9 +286,11 @@ open class HtmlRenderer( text(textNode.text) } - override fun render(root: RootPageNode) { - super.render(root) - outputWriter.write("scripts/pages", "var pages = [\n${pageList.joinToString(",\n")}\n]", ".js") + override fun CoroutineScope.render(root: RootPageNode): Job { + super.renderImpl(this, root) + return launch(Dispatchers.IO) { + outputWriter.write("scripts/pages", "var pages = [\n${pageList.joinToString(",\n")}\n]", ".js") + } } private fun PageNode.root(path: String) = locationProvider.resolveRoot(this) + path |
