Skip to content
Promise Patterns
step 1/5

Reading — step 1 of 5

Learn

~1 min readAsync JavaScript

A few patterns you'll use over and over.

Promisify a callback API:

js

(Node has util.promisify to do this generically.)

Sleep:

js

Run multiple in parallel:

js

With a max concurrency — when you have 1000 things and don't want 1000 parallel requests:

js

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…

Promise Patterns — JavaScript Intermediate