useThrottle
useThrottle(
seconds,identifier?):boolean
Defined in: src/std/hooks/useThrottle.ts:25
Throttles execution based on a time interval in seconds.
Returns true if the specified time interval has passed since the last true return,
otherwise returns false.
An optional identifier can be provided to create separate throttle states for different usages.
Parameters
Section titled “Parameters”seconds
Section titled “seconds”number
identifier?
Section titled “identifier?”unknown
Returns
Section titled “Returns”boolean
Example
Section titled “Example”function logNames() { query(Name).forEach((_, name) => { // This log will only occur once per second per unique name. if (useThrottle(1, name)) { print(`Throttled log: ${name.value}`) } })}