Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Kim committed May 25, 2024
1 parent 50bdcdb commit ce4c420
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@
" data-index="29"><br></div><div class="
prism-line
css-1flouoi
" data-index="30"><code> <span class="token comment">// The this of a Crank component is an iterable of props.</span></code><br></div><div class="
" data-index="30"><code> <span class="token comment">// The context passed to a Crank component is an iterable of props.</span></code><br></div><div class="
prism-line
css-1flouoi
" data-index="31"><code> <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span> <span class="token keyword">of</span> ctx<span class="token punctuation">)</span> <span class="token punctuation">{</span></code><br></div><div class="
Expand Down Expand Up @@ -743,7 +743,7 @@
if (window.__embeddedJSON__ == null) {
window.__embeddedJSON__ = {};
}
window.__embeddedJSON__['embedded-json-4'] = {"code":"import {renderer} from \"@b9g\u002Fcrank\u002Fdom\";\n\nfunction *Timer({}, ctx) {\n let interval = null;\n let seconds = 0;\n const startInterval = () =\u003E {\n interval = setInterval(() =\u003E {\n seconds++;\n ctx.refresh();\n }, 1000);\n };\n\n const toggleInterval = () =\u003E {\n if (interval == null) {\n startInterval();\n } else {\n clearInterval(interval);\n interval = null;\n }\n\n ctx.refresh();\n };\n\n const resetInterval = () =\u003E {\n seconds = 0;\n clearInterval(interval);\n interval = null;\n ctx.refresh();\n };\n\n \u002F\u002F The this of a Crank component is an iterable of props.\n for ({} of ctx) {\n \u002F\u002F Welcome to the render loop.\n \u002F\u002F Most generator components should use render loops even if they do not\n \u002F\u002F use props.\n \u002F\u002F The render loop provides useful behavior like preventing infinite loops\n \u002F\u002F because of a forgotten yield.\n yield (\n \u003Cdiv\u003E\n \u003Cp\u003E{seconds} second{seconds !== 1 && \"s\"}\u003C\u002Fp\u003E\n \u003Cbutton onclick={toggleInterval}\u003E\n {interval == null ? \"Start timer\" : \"Stop timer\"}\n \u003C\u002Fbutton\u003E\n {\" \"}\n \u003Cbutton onclick={resetInterval}\u003EReset timer\u003C\u002Fbutton\u003E\n \u003C\u002Fdiv\u003E\n );\n }\n\n \u002F\u002F You can place cleanup code after the loop.\n clearInterval(interval);\n}\n\nrenderer.render(\u003CTimer \u002F\u003E, document.body);","lang":"jsx live"};
window.__embeddedJSON__['embedded-json-4'] = {"code":"import {renderer} from \"@b9g\u002Fcrank\u002Fdom\";\n\nfunction *Timer({}, ctx) {\n let interval = null;\n let seconds = 0;\n const startInterval = () =\u003E {\n interval = setInterval(() =\u003E {\n seconds++;\n ctx.refresh();\n }, 1000);\n };\n\n const toggleInterval = () =\u003E {\n if (interval == null) {\n startInterval();\n } else {\n clearInterval(interval);\n interval = null;\n }\n\n ctx.refresh();\n };\n\n const resetInterval = () =\u003E {\n seconds = 0;\n clearInterval(interval);\n interval = null;\n ctx.refresh();\n };\n\n \u002F\u002F The context passed to a Crank component is an iterable of props.\n for ({} of ctx) {\n \u002F\u002F Welcome to the render loop.\n \u002F\u002F Most generator components should use render loops even if they do not\n \u002F\u002F use props.\n \u002F\u002F The render loop provides useful behavior like preventing infinite loops\n \u002F\u002F because of a forgotten yield.\n yield (\n \u003Cdiv\u003E\n \u003Cp\u003E{seconds} second{seconds !== 1 && \"s\"}\u003C\u002Fp\u003E\n \u003Cbutton onclick={toggleInterval}\u003E\n {interval == null ? \"Start timer\" : \"Stop timer\"}\n \u003C\u002Fbutton\u003E\n {\" \"}\n \u003Cbutton onclick={resetInterval}\u003EReset timer\u003C\u002Fbutton\u003E\n \u003C\u002Fdiv\u003E\n );\n }\n\n \u002F\u002F You can place cleanup code after the loop.\n clearInterval(interval);\n}\n\nrenderer.render(\u003CTimer \u002F\u003E, document.body);","lang":"jsx live"};
</script></div><h3 class="css-1dn8fdv">Reason #3: It’s promise-friendly.</h3><p class="css-dzajps"><span class="css-rvz5kp">Any component can be made asynchronous with the <code class="inline">async</code> keyword. This means you can await <code class="inline">fetch()</code> directly in a component, client or server.</span></p><div class="
code-block-container
css-tz77l4
Expand Down

0 comments on commit ce4c420

Please sign in to comment.