Created
January 16, 2024 19:35
-
-
Save didierbrun/50c187ef70aa316456c3985e90d2cfca to your computer and use it in GitHub Desktop.
Suspense
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
const suspense = (f, t) => setTimeout(f, t * 1000) | |
const message = () => { | |
let t = 0 | |
suspense(() => { | |
console.log("Je veux que créer...") | |
}, t) | |
suspense(() => { | |
console.log("...un peu de...") | |
}, t+1) | |
suspense(() => { | |
console.log("... Suspense !") | |
}, t+2) | |
} | |
const tambour = () => { | |
let i = 0 | |
while(++i<10){ | |
suspense(() => { | |
console.log("tadam...") | |
}, i * .2) | |
} | |
} | |
message() | |
tambour() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment