Skip to content

Instantly share code, notes, and snippets.

@jacksonwillis
Created May 18, 2012 19:07
Show Gist options
  • Save jacksonwillis/2727084 to your computer and use it in GitHub Desktop.
Save jacksonwillis/2727084 to your computer and use it in GitHub Desktop.
Coffeescript Idiomatic Timing Events
inAbout = (n) -> new ->
@milliseconds = (f) -> setTimeout f, n
@seconds = (f) -> setTimeout f, n * 1000
every = (n) -> new ->
@milliseconds = (f) -> setInterval f, n
@seconds = (f) -> setInterval f, n * 1000
console.log "starting!"
inAbout(3).seconds ->
console.log "waited 3 seconds."
console.log "waiting to have waited..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment