Stay organized with collections
Save and categorize content based on your preferences.
Wraps a function to allow it to be called, at most, once for each sequence of calls fired repeatedly so long as they are fired less than a specified interval apart (in milliseconds). This can be used to reduce the number of invocations of an expensive function while ensuring it eventually runs.
Example use: For the callback to a change event on a ui.Checkbox. If the user clicks the checkbox repeatedly, only the last click of the checkbox will run the callback.
Returns the debounced function.
Usage
Returns
ui.util.debounce(func, delay, scope)
Function
Argument
Type
Details
func
Function
The function to debounce.
delay
Number
After the function is called once, the number of milliseconds to delay for an additional invocation of the function before allowing it to run.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["Debounces a function, limiting its execution to at most once within a specified time interval, even with repeated calls."],["Useful for optimizing expensive functions triggered by frequent events, ensuring only the last call within the interval is executed."],["Returns a debounced version of the original function, which can be called directly."],["Customizable with parameters like `delay` for setting the debounce interval and `scope` for controlling the function's execution context."]]],[]]