mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Commit and whitespace nits in debounce.
This commit is contained in:
@@ -51,9 +51,9 @@ import isObject from './isObject.js'
|
|||||||
*
|
*
|
||||||
* // Cancel the trailing debounced invocation.
|
* // Cancel the trailing debounced invocation.
|
||||||
* jQuery(window).on('popstate', debounced.cancel)
|
* jQuery(window).on('popstate', debounced.cancel)
|
||||||
*
|
*
|
||||||
* // Check for pending invocations.
|
* // Check for pending invocations.
|
||||||
* const status = debounced.pending() ? "Pending…" : "Ready"
|
* const status = debounced.pending() ? "Pending..." : "Ready"
|
||||||
*/
|
*/
|
||||||
function debounce(func, wait, options) {
|
function debounce(func, wait, options) {
|
||||||
let lastArgs,
|
let lastArgs,
|
||||||
@@ -151,7 +151,7 @@ function debounce(func, wait, options) {
|
|||||||
function flush() {
|
function flush() {
|
||||||
return timerId === undefined ? result : trailingEdge(Date.now())
|
return timerId === undefined ? result : trailingEdge(Date.now())
|
||||||
}
|
}
|
||||||
|
|
||||||
function pending() {
|
function pending() {
|
||||||
return timerId !== undefined
|
return timerId !== undefined
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user