Goal
Add a throttle() function and @throttle() method decorator for sync and async functions.
const fetchProfile = throttle(
async (userId: string) => api.getProfile(userId),
{ limit: 3, interval: 1_000 }
);
Scope
- Configurable
limit and interval
leading / trailing behavior
- Preserve
this, arguments, return type and errors
- Per-instance state for decorated instance methods
AbortSignal, cancel(), and queue-size visibility
- Unit tests and documentation
Trace integration
Record delayed, executed, cancelled, and rejected calls in the engine trace.
Acceptance criteria
- Supports synchronous and Promise-returning functions
- Concurrent callers retain their original arguments and receive the correct outcome
- Decorator state is isolated per class instance
- Public API is exported from the package entry point
Goal
Add a
throttle()function and@throttle()method decorator for sync and async functions.Scope
limitandintervalleading/trailingbehaviorthis, arguments, return type and errorsAbortSignal,cancel(), and queue-size visibilityTrace integration
Record delayed, executed, cancelled, and rejected calls in the engine trace.
Acceptance criteria