Closed bengourley closed 7 years ago
I added another commit to implement the debounceImmediate: true|false
option that decides whether an event should be emitted on the leading edge of the window (terminology borrowed from https://npm.im/debounce). This means that the internal debounce function is feature complete and usable. I set the default to true
which means the existing behaviour is maintained.
Closing because of failing test on various platforms and lack of activity.
I came up against the issue in #142 where the last change event is discarded. This ensures that the last event will fire after some are debounced.
I used the test that @motemen created in #142 but I found a simpler way to implement the logic.
In the grand schema of things I think debouncing/throttling should be left up to the user (re: your comments @shama https://github.com/shama/gaze/pull/142#issuecomment-94080660) but since this is already inside the module I thought I'd fix the bug. Feel free to remove everything later :)