Platform
Resources
Pricing
Sign in
Get started
Philippe Deschaseaux
Workspace
Fork
Public
Tools
By
Philippe Deschaseaux
Edited
May 26, 2021
10 stars
Tools
Hello Vixel
Shared gpu.js graphical shader
SVG renderer for ELK graph layout
Zoom and pan
SVG utility
UML class diagram generation
Multiple promises as an async generator
How to get image data from an URL or a File
Decoding TIFF image data
Utils
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
genMerge1
=
promises
=>
Generators
.
queue
(
change
=>
promises
.
forEach
(
p
=>
p
.
then
(
change
)
)
)
Insert cell
Insert cell
Insert cell
genMerge2
=
async
function
*
(
promises
)
{
let
nb
=
promises
.
length
for
await
(
const
res
of
genMerge1
(
promises
)
)
{
yield
res
if
(
!
--
nb
)
break
}
}
Insert cell
Insert cell
Insert cell
genMerge3
=
async
function
*
(
promises
)
{
const
map
=
new
Map
(
promises
.
map
(
(
p
,
i
)
=>
[
i
,
p
.
then
(
res
=>
[
i
,
res
]
)
]
)
)
;
while
(
map
.
size
)
{
const
[
key
,
result
]
=
await
Promise
.
race
(
map
.
values
(
)
)
;
yield
result
;
map
.
delete
(
key
)
;
}
}
Insert cell
Insert cell
Insert cell
promises
=
(
)
=>
[
...
Array
(
100
)
]
.
map
(
(
_
,
i
)
=>
Promises
.
delay
(
Math
.
random
(
)
*
10000
,
i
)
)
Insert cell
genMerge1
(
promises
(
)
)
Insert cell
genMerge2
(
promises
(
)
)
Insert cell
genMerge3
(
promises
(
)
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
genMerge1
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
genMerge2
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
genMerge3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
promises
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML