Created
December 4, 2017 20:19
-
-
Save Rich-Harris/57c593fe51790055f871c3fadc342fa8 to your computer and use it in GitHub Desktop.
out-of-order streaming SSR
This file contains 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
<body> | |
<header> | |
<h1>Hello world!</h1> | |
</header> | |
<main> | |
<noscript id='__await_block_0_start'></noscript> | |
<p>loading...</p> | |
<noscript id='__await_block_0_end'></noscript> | |
</main> | |
<footer> | |
copyright 2017 this guy | |
</footer> | |
</body> | |
<script> | |
removeNodesBetween(__await_block_0_start, __await_block_0_end); | |
__await_block_0_start.insertAdjacentHTML('afterend', '<p>the value is 42</p>'); | |
__await_block_0_start.parentNode.removeChild(__await_block_0_start); | |
__await_block_0_end.parentNode.removeChild(__await_block_0_end); | |
function removeNodesBetween(start, end) { | |
// TODO implement | |
} | |
</script> |
This file contains 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
<body> | |
<header> | |
<h1>{{title}}</h1> | |
</header> | |
<main> | |
{{#await promise}} | |
<p>loading...</p> | |
{{then value}} | |
<p>the value is {{value}}</p> | |
{{catch error}} | |
<p>oh no! {{error.message}}</p> | |
{{/await}} | |
</main> | |
<footer> | |
copyright 2017 this guy | |
</footer> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment