Skip to content

feat(android-timer): setInterval closer to web spec#9044

Merged
NathanWalker merged 5 commits into
NativeScript:masterfrom
edusperoni:timer-fix
Nov 19, 2020
Merged

feat(android-timer): setInterval closer to web spec#9044
NathanWalker merged 5 commits into
NativeScript:masterfrom
edusperoni:timer-fix

Conversation

@edusperoni
Copy link
Copy Markdown
Contributor

@edusperoni edusperoni commented Nov 16, 2020

PR Checklist

What is the current behavior?

setInterval on Android will keep delaying if busy work is done during the callback

setInterval(..., 1000) will almost never call 10 times every exact 10s.

What is the new behavior?

setInterval now works like the web, calling every x ms, which means sometimes it'll call more/less often depending on the amount of work being done.

setInterval(..., 1000) will almost always call 10 times every 10s (exception is if work took longer than 1000ms to be called)

@cla-bot cla-bot Bot added the cla: yes label Nov 16, 2020
@edusperoni edusperoni marked this pull request as draft November 16, 2020 16:42
@edusperoni
Copy link
Copy Markdown
Contributor Author

Concerns about this are if Date.now() changes (system time updates). Is there a consistent way to ensure this isn't an issue?

@edusperoni edusperoni changed the title feat(timer): setInterval closer to web spec feat(android-timer): setInterval closer to web spec Nov 19, 2020
@edusperoni edusperoni marked this pull request as ready for review November 19, 2020 18:49
@edusperoni
Copy link
Copy Markdown
Contributor Author

Just tested this on iOS and it's already working properly. I believe this can be merged

@NathanWalker NathanWalker merged commit 1769de9 into NativeScript:master Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants