flightjs/flight — pull request #304 by brettstimmerman (2014-08-26 22:42:39+00:00)
Title: Avoid unnecessary clearTimeouts in debounce()

debounce() used to return a function that when first invoked always called
`clearTimeout` before `setTimeout`, even if there was no timeout to clear.

This change adds a guard to prevent such unnecessary `clearTimeout` calls.
The performance implications are likely minimal, but the boolean check should
perform better in general than what amounts to a noop function call when
`timeout` is `null`. As well, devtools timelines will no longer display a
not-useful "Remove Timer" scripting blip for unnecessary `clearTimeout`s.