Created
July 15, 2020 20:04
-
-
Save pedroborges/f8968c2a55eaaa0b68ce927d3662323c to your computer and use it in GitHub Desktop.
Ways to fake API request delay during development
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 wait = (delay, data) => ({ then(resolve) { setTimeout(resolve, delay, data) } }) | |
const fakeApi = async () => await wait(500, [1, 2, 3, 4]) |
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 wait = (delay, data) => new Promise((resolve) => setTimeout(resolve, delay, data)) | |
const fakeApi = async () => await wait(500, [1, 2, 3, 4]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment