Created
February 25, 2020 19:19
-
-
Save yairEO/ed5da9df0144fdbd2d214b4760406443 to your computer and use it in GitHub Desktop.
mock async AJAX request
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 mockAjax = (timeout => (RES, duration) => { | |
clearTimeout(timeout); // abort last request | |
return new Promise((resolve, reject) => timeout = setTimeout(resolve, duration || 0, RES)) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment