Use setTimeout() trick instead of Window.requestIdleCallback() (#3044)

This commit is contained in:
daxpedda
2023-08-25 21:40:21 +02:00
committed by Kirill Chibisov
parent a8a0462c0d
commit a24d092fa1
7 changed files with 198 additions and 133 deletions

View File

@@ -627,9 +627,11 @@ impl<T: 'static> Shared<T> {
ControlFlow::Poll => {
let cloned = self.clone();
State::Poll {
request: backend::IdleCallback::new(self.window().clone(), move || {
cloned.poll()
}),
request: backend::Schedule::new(
self.window().clone(),
move || cloned.poll(),
None,
),
}
}
ControlFlow::Wait => State::Wait {
@@ -649,10 +651,10 @@ impl<T: 'static> Shared<T> {
State::WaitUntil {
start,
end,
timeout: backend::Timeout::new(
timeout: backend::Schedule::new(
self.window().clone(),
move || cloned.resume_time_reached(start, end),
delay,
Some(delay),
),
}
}