Skip to content

Instantly share code, notes, and snippets.

@devrim
Created January 27, 2011 04:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devrim/798078 to your computer and use it in GitHub Desktop.
Save devrim/798078 to your computer and use it in GitHub Desktop.
class kdApi
@tries=0
constructor:->
@apicall(1)
returned:(r)->
if r isnt 10
setTimeout () =>
@apicall r
,1000
else
@finished r
finished:(r)->
console.log "finished with "+r
apicall:(i)->
@tries++
console.log "called with "+i+" @tries:"+@tries
@returned Math.floor Math.random()*11
new kdApi()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment