Referencing information found in this source:
const debouncedInput = example.debounceTime(5);
const subscribe = debouncedInput.subscribe(val => {
console.log(`Debounced Input: ${val}`);
});
When the first keyup event occurs, will the debouncedInput
be delayed for 5 milliseconds before notifying the observer?
If the user continues typing before the 5 millisecond duration is up, does the debouncedInput
Observable require a full uninterrupted 5 millisecond interval to pass before emitting the event/source value?
Illustrated by an example (as seen in the helpful marble diagram in @OJKwon's response), let's say each dash (-) represents a millisecond. In the scenario below:
-a--b--c-------d
The timer monitoring the time intervals would reset at the following points:
- 2 ms after 'a' is typed
- 5 ms after 'b' is typed
- 8 ms after 'c' is typed
- 9, 10, 11, 12, 13 ms elapse
- 'abc' is emitted at 13 ms as no other events occur during that period
- The timer resets at 14 ms when 'd' is typed
- 'abcd' is emitted at 19 ms with no additional values inputted