Skip to content

Isolate decorated throttle and debounce state per instance - #43

Open
feritcemkahraman wants to merge 1 commit into
github:mainfrom
feritcemkahraman:fix/per-instance-decorators
Open

feritcemkahraman wants to merge 1 commit into
github:mainfrom
feritcemkahraman:fix/per-instance-decorators

Conversation

@feritcemkahraman

Copy link
Copy Markdown

Summary

  • Two instances with a @debounce or @throttle decorated method currently share a single wrapper on the prototype: calling the second instance cancels or delays the first instance's pending timer, and once: true disables the method across all other instances after the first call.
  • Cache a separate throttled or debounced wrapper per receiver in a WeakMap while preserving function identity, per-instance .cancel(), and writable instance property overrides.

Testing

  • npx eslint . --report-unused-disable-directives
  • npx tsc --noEmit && npm run build-umd && npm run build-esm
  • npx vitest run (Playwright Chromium Headless: 26 passed)
  • Note: Firefox / WebKit browser matrices were not run locally.

@feritcemkahraman
feritcemkahraman requested a review from a team as a code owner October 18, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant