Skip to main content

use_back_button

Function use_back_button 

Source
pub fn use_back_button(handler: impl FnMut() + 'static) -> WinitEventHandlerId
Expand description

Register a handler that runs when the back button is pressed.

This builds on top of use_window_event: the back button is delivered by winit as a WindowEvent::KeyboardInput whose logical key is NamedKey::BrowserBack. This most commonly comes from the Android hardware/system back button, but may also be produced by a keyboard or mouse back key on other platforms. The provided handler is called once each time the button is pressed (key repeats are ignored).

Returns a WinitEventHandlerId which can be used to remove the handler.