what correct syntax using underscore debounce in coffeescript?
in program, following print 'keyup', not print 'do something' desired behavior 'do something' printed after 300ms after user stops typing inside text input.
onkeyupevent = (e) -> console.log 'keyup' _.debounce((=> console.log 'do something' ), 300)
_.debounce()
returns function. have assign variable once , call variable.
debounced = _.debounce((=> console.log 'do something' ), 300) onkeyupevent = (e) -> console.log 'keyup' debounced()
Comments
Post a Comment