jashkenas/underscore — pull request #1292 by danmane (2013-09-19 06:20:57+00:00)
Title: Change debounce so that it calls immediately if wait is 0

Right now, if _.debounce is called with a wait of 0, it will set a timeout for the later callback before calling the func. As a result it takes a noticeable period amount of time for the callback to call, this can be obvious and annoying in graphics application / animation.

Admittedly setting a debounce with a wait of 0 is an edge case, but might occur if it is given as a parameter, or if debouncing is activated dynamically based on performance considerations.

This change has an extremely low touch and the logic only applies in the case where wait === 0.