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

This commit is contained in:
daxpedda 2023-08-25 21:40:21 +02:00 committed by GitHub
parent 68ef9f707e
commit 48abf52aac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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),
),
}
}