pub fn add_idle_callback<F>(&self, callback: F)
    where
        F: FnOnce(&mut dyn WinHandler) + Send + 'static,
    {
        let mut queue = self.queue.lock().expect("IdleHandle::add_idle queue");
        queue.push(IdleKind::Callback(Box::new(callback)));

        if queue.len() == 1 {
            if let Some(window_state) = self.state.upgrade() {
                let state = window_state.clone();
                window_state
                    .request_animation_frame(move || {
                        state.process_idle_queue();
                    })
                    .expect("request_animation_frame failed");
            }
        }
    }
/// Add an idle handler, which is called (once) when the main thread is idle.
Add an idle handler, which is called (once) when the main thread is idle.
Add an idle handler which is called ( once ) when the main thread is idle .
pub fn add_idle_callback<F>(&self, callback: F)
    where
        F: FnOnce(&mut dyn WinHandler) + Send + 'static,
    {
        let mut queue = self.queue.lock().expect("IdleHandle::add_idle queue");
        queue.push(IdleKind::Callback(Box::new(callback)));
        if queue.len() == 1 {
            if let Some(window_state) = self.state.upgrade() {
                let state = window_state.clone();
                window_state
                    .request_animation_frame(move || {
                        state.process_idle_queue();
                    })
                    .expect("request_animation_frame failed");
            }
        }
    }
pub fn add_idle_callback < F > ( & self , callback : F ) where F : FnOnce ( & mut dyn WinHandler ) + Send + ' static , { let mut queue = self . queue . lock ( ) . expect ( " " ) ; queue . push ( IdleKind :: Callback ( Box :: new ( callback ) ) ) ; if queue . len ( ) == 1 { if let Some ( window_state ) = self . state . upgrade ( ) { let state = window_state . clone ( ) ; window_state . request_animation_frame ( move | | { state . process_idle_queue ( ) ; } ) . expect ( " " ) ; } } }
Add an idle handler, which is called (once) when the main thread is idle.
Add an idle handler which is called ( once ) when the main thread is idle .
&self
callback
F
&self
callback
F