Skip to content

Instantly share code, notes, and snippets.

@arianvp
Last active October 28, 2024 11:17
Show Gist options
  • Save arianvp/2d913db27be1f9c227a09909484262ea to your computer and use it in GitHub Desktop.
Save arianvp/2d913db27be1f9c227a09909484262ea to your computer and use it in GitHub Desktop.
longComputation = do
threaDelay 5000
pure ["a", "b" ,"c"]
longComputation2 = do
threadDelay 3000
pure "lol"
website = do
h1 "Hello, World!"
p "This is a paragraph."
suspense (p "loading...") do
x <- longComputation
ul $ for longComputation $ \x ->
susepense (li "loading...") do
y <- longComputation2
li x
[html|
<h1>Hello, World!</h1>
<p>This is a paragraph.</p>
<suspense shadowrootmode="open">
<template>
<slot name="0">
<p>loading...</p>
</slot>
</template>
|]
FLUSH
SLEEP 5000
[html|
<ul slot="0">
<suspense shadowrootmode="open">
<template>
<slot name="0">
<li>loading...</li>
</slot>
<slot name="1">
<li>loading...</li>
</slot>
<slot name="2">
<li>loading...</li>
</slot>
</template>
|]
FLUSH
SLEEP 3000
[html|
<li slot="0">a</li>
|]
FLUSH
SLEEP 3000
[html|
<li slot="1">b</li>
|]
FLUSH
SLEEP 3000
[html|
<li slot="2">c</li>
</suspense>
</ul>
</suspense>
|]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment