Created
August 1, 2023 10:52
-
-
Save piotrekwitkowski/ed71ef37f78954e5e869a0b7d98fa3be to your computer and use it in GitHub Desktop.
Typescript HOC withDelay
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 withDelay = async <T,>(delay = 0, callback: () => T) => { | |
await new Promise(resolve => setTimeout(resolve, delay)); | |
return callback(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment