Deprecated in favor to Wraperizer.throttleAsync. No longer support.
Throttled
Create wrapper for a function that returns a promise. Uses to throttle frequent or repeated calls.
Parameters
fn
function function that returns a promiseconfig
object? config objectconfig.stay
function function that checks isfn
invokes is necessary (optional, defaultfunction(){returnfalse}
)config.logs
any? determines is internal logs needed
Examples
const Throttled = ; const config = {} const fn = ; let throttled = fn config;let params = {};const r1 = throttled; // will invoke `fn` and return Promiseconst r2 = throttled; // will return old Promise
run
invokes fn and returns resulting promise
Parameters
-
params
Object arguments for fn call -
Throws Error throws an error if result returned
fn
is not a Promise
Returns Promise
stay
getter - returns current stay
function
Returns function
stay
setter - set new value of stay
function
Parameters