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: get betterSetInterval ready for 2025 #496

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fnesveda
Copy link
Member

Historically, functions scheduled with betterSetInterval needed to accept a callback and then call it when done, to schedule their next invocation. This was because Promises were not a thing in 2015 when this function was originally written. It's silly to have this requirement now, almost ten years later, when async/await and Promises are a normal feature.

This change adds support for scheduling any function, sync or async, accepting or not accepting a callback, and having it just work.

betterSetInterval(async () => {
    await myAsyncOperation();
}, 1000);

For backwards compatibility reasons, a dummy callback is still passed to the invoked function as its first argument, otherwise the functions that don't expect this change would break.

@fnesveda fnesveda added adhoc Ad-hoc unplanned task added during the sprint. t-platform Issues with this label are in the ownership of the platform team. labels Dec 17, 2024
@fnesveda fnesveda added this to the 105th sprint - Platform Team milestone Dec 17, 2024
@fnesveda fnesveda requested review from B4nan and gippy December 17, 2024 19:11
@fnesveda fnesveda self-assigned this Dec 17, 2024
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adhoc Ad-hoc unplanned task added during the sprint. t-platform Issues with this label are in the ownership of the platform team. tested Temporary label used only programatically for some analytics.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants