Use Window.requestIdleCallback()

This commit is contained in:
dAxpeDDa 2023-06-13 16:39:06 +02:00 committed by daxpedda
parent a444637b18
commit 7ce86c3d2a
6 changed files with 59 additions and 26 deletions

View file

@ -442,10 +442,9 @@ impl<T: 'static> Shared<T> {
ControlFlow::Poll => {
let cloned = self.clone();
State::Poll {
request: backend::AnimationFrameRequest::new(
self.window().clone(),
move || cloned.poll(),
),
request: backend::IdleCallback::new(self.window().clone(), move || {
cloned.poll()
}),
}
}
ControlFlow::Wait => State::Wait {

View file

@ -15,7 +15,7 @@ pub enum State {
start: Instant,
},
Poll {
request: backend::AnimationFrameRequest,
request: backend::IdleCallback,
},
Exit,
}