Skip to content

Commit

Permalink
fix(DispatcherQueueTimer): [Wasm] Ensure ticks are raised on the disp…
Browse files Browse the repository at this point in the history
…atcher
  • Loading branch information
jeromelaban committed Dec 8, 2022
1 parent b0ba0a8 commit c7f011a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Uno.UWP/System/DispatcherQueueTimer.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ private void StartNative(TimeSpan dueTime, TimeSpan interval)
{
if (_timer == null)
{
_timer = new Timer(_ => RaiseTick());
_timer = new Timer(_ => DispatchRaiseTick());
}

_timer.Change(dueTime, interval);
}

private void DispatchRaiseTick()
{
_ = Uno.UI.Dispatching.CoreDispatcher.Main.RunAsync(Uno.UI.Dispatching.CoreDispatcherPriority.Normal, () => RaiseTick());
}

private void StopNative()
{
_timer.Dispose();
Expand Down

0 comments on commit c7f011a

Please sign in to comment.