Skip to content

Instantly share code, notes, and snippets.

@slifin
Last active January 3, 2016 01:39
Show Gist options
  • Save slifin/8390888 to your computer and use it in GitHub Desktop.
Save slifin/8390888 to your computer and use it in GitHub Desktop.
CoffeeScript 1 second of request frames (doesn't end gracefully)
class Game
loop:0
started: Date.now();
start: ->
window.requestAnimationFrame(this.step())
step:->
console.log 'test'
this.loop += 1
if (this.started+1000<Date.now())
console.log this.loop
window.cancelRequestAnimationFrame()
this.start()
game = new Game
game.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment