new debounce(callback, wait) → {function}
A debounced function is a function that will delay the execution of the inner (callback) function
by a certain amount of time each time the debounced (returned) function is called. In our case,
we don't want to spellcheck text every time the user presses a key, so we debounce the spellcheck
function with each keypress. This way each keypress will delay the spellcheck logic by {wait},
which means we will only spellcheck text after the user has stopped typing.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
callback |
function
|
the callback function to be executed after wait expires |
wait |
number
|
the amount of time, in milliseconds, to debounce the function |
Returns:
- Type:
-
function
- the function to be executed after wait