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

feat: add runScheduledNow and updateImmediately to Debounce #142

Merged

Conversation

Coronon
Copy link
Contributor

@Coronon Coronon commented Nov 2, 2024

This PR adds runScheduledNow to useDebounce and updateImmediately to Debounced.

Both new methods will run the most recently scheduled call now, instead of waiting for the debounce duration. They return a Promise<void> that resolves when the debounced call they preemptively run settles.

I also added documentation for both of these new functions. I moved the new "Run now" button ahead of the "Cancel message" button for useDebounce because users have to click it quickly to notice the difference from the normal debounced call, whereas canceling will always be obvious.

Resolves #134

Builds on top of #141

Let me know of any changes you want me to make :)

Copy link
Contributor

github-actions bot commented Nov 25, 2024

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
runed ✅ Ready (View Log) Visit Preview 7026819

Copy link

changeset-bot bot commented Nov 25, 2024

🦋 Changeset detected

Latest commit: 7026819

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
runed Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@huntabyte huntabyte left a comment

Choose a reason for hiding this comment

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

Thank you!

@huntabyte huntabyte changed the title feat: add runScheduledNow and updateImmediately to debounce feat: add runScheduledNow and updateImmediately to Debounce Dec 6, 2024
@huntabyte huntabyte merged commit eacea9a into svecosystem:main Dec 6, 2024
4 checks passed
@Coronon Coronon deleted the feature/useDebounce-runScheduledNow branch December 6, 2024 23:00
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.

add method to fire any scheduled use-debounce call now
2 participants