Sleep functionality in coffeescript
CoffeeScript 2
threshold = 2000
start = new Date().getTime()
console.log start
i = 0
while i < 1e12
time = new Date().getTime()
if time - start > threshold
console.log 'delay threshold met'
break
i++
end = new Date().getTime()
console.log end
console.log 'after delay'