Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call original debounced function with proper "this" context #456

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

primeare
Copy link
Member

@primeare primeare commented Nov 28, 2022

Notable Changes

  • metasync preserves debounced function's "this" context
  • debounced function can be called with specific arguments (not only with the pre-populated ones)
  • new changes are backward compatible with previous metasync API

Checks

  • tests and linter show no problems (npm t)
  • tests are added/updated for bug fixes and new features
  • code is properly formatted (npm run fmt)

- reuse timer if the refresh method is available
- call original function with "this" of debounced function
@primeare primeare self-assigned this Nov 28, 2022
@primeare
Copy link
Member Author

The CI is failing as Node.js 12 does not support the optional chaining operator. Should I update my code, or could we just drop Node.js 12 as it has got its end of life at 2022-04-30?

Copy link
Member

@tshemsedinov tshemsedinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't drop node12 support as of now because metasync is quite old library and we use it in multiple legacy projects, so please rewrite without optional chaining operator.

- fix backward compatibility with Node.js 12
- add ability to call debounced function with new arguments
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.

3 participants