I'm trying to implement the code from this SO question in coffeescript.
This is what I've got but it doesn't work.
class SomeClass
initialize: ->
target = view.$('#finder')
typewatch = do ->
timer = 0;
(callback, ms) ->
clearTimeout timer
timer = setTimeout callback, ms
target.keyup =>
typewatch @someMethod(target.val()), 1000
someMethod: (arg) ->
// do something
someMethod
gets called without any delay. It seems like setTimeout isn't being called at all.