Experimental decorators for common patterns.
import { Bind, Memoize } from '@boost/decorators';
class Example {
@Bind()
referencedMethod() {
return this; // Class instance
}
@Memoize()
someExpensiveOperation() {
// Do something heavy
}
}
-
@Bind
- Autobind a method'sthis
to the class context. -
@Debounce
- Defer the execution of a method in milliseconds. -
@Deprecate
- Mark a property, method, or class as deprecated. -
@Memoize
- Cache and return the result of a method execution. -
@Throttle
- Throttle the execution of a method to a timeframe in milliseconds.
yarn add @boost/decorators