Created
January 18, 2018 17:40
-
-
Save jjb/ab02bfa90b29b1aba96f78bb600dfcae to your computer and use it in GitHub Desktop.
Sleep in coffeescript
This file contains hidden or 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
sleep = (ms)-> | |
date = new Date() | |
loop | |
break if (new Date())-date > ms | |
# from https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep | |
# as foretold in a million passionate comments by programmers 'round the world, | |
# using this in business logic in javascript is a bad idea. but it sometimes comes in | |
# handy when trying to experiment with something in dev (like if you want to simulate | |
# a timeout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment