🧚decorator
takes a function and alters/extends its behavior. 🚧 under construction
(function) alters/extends the behavior of another function.
saveCallHistory(f) - make function save its call history ("arguments").
memoize(f) - make function "remember" its "return values".
delay(f, s) - delay the execution of a function by s seconds.
debounce(f, s) - debounce function calls for s seconds.
throttle(f, s) - throttle function calls by every s seconds.
debounce vs. throttle - difference between the two.
if the original function had properties on it, like
func.calledCountor whatever, then the decorated one will not provide them❗there's a way to create decorators that keep access to function properties, but this requires using a special
Proxyobject to wrap a function. 👉 Proxy and Reflect.
benchmark(f) - timed version of a function.
Last updated
Was this helpful?