This is my CoffeeScript code.
setTimeout (-> @checkProgress()), 5000
When I run this in the browser I get the following error:
TypeError: this.checkProgress is not a function
The method looks like:
checkProgress: ->
~ code
~ code
~ code
setTimeout (-> @checkProgress()), 5000
So at some point I want to call the method again. How can I do this? Thanks.
@checkProgressis already afunction. You do not need to wrap it in anotherfunction. Just usesetTimeout @checkProgress, 5000delay = (t, fn) -> setTimeout(fn, t).