class Game
foo: null
play: ->
@foo = 2
@animate()
animate: ->
requestAnimationFrame( @animate, 1000 )
console.log('foo = ', @foo)
$ ->
game = null
init = ->
game = new Game()
game.play()
init()
Gameのanimateメソッドのログは次のようになります。
foo = 2
foo = undefined
したがって、fooはanimateの最初の呼び出しで2であり、その後は未定義です。誰かが私がこれを修正できる理由と方法を説明してもらえますか?どんな助けでも大歓迎です。