Skip to content

Conversation

vmoroz
Copy link
Member

@vmoroz vmoroz commented Apr 14, 2023

In this PR we add support for timers to the JSDispatcherQueue class.
The API design follows the DispatcherQueueTimer for WinRT.

Each timer submits to JSDispatcherQueue an instance of JSDispatcherQueueTimer.Job class.
It is added initially as a normal work item. So, that the timer job with delay 0 will behave the same way as any other JSDispatcherQueue task. If the time to execute the timer job is not expired yet, then we put it in a sorted job list.
Next time we look for new items we consider items from the job list.
We also consider the time to run next job when we start waiting for new work items.

In a follow up PR we will start using it for the hermes-engine example.

@vmoroz vmoroz requested a review from jasongin April 14, 2023 18:42
@vmoroz vmoroz merged commit d0b288c into microsoft:main Apr 15, 2023
@vmoroz vmoroz deleted the PR/TimerSupport branch April 15, 2023 13:17
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