Struct sauron_core::dom::Window
source · pub struct Window;
Expand description
Provides access to the Browser window
Implementations§
source§impl Window
impl Window
sourcepub fn add_event_listeners<APP, MSG>(
event_listeners: Vec<Attribute<MSG>>
) -> Cmd<APP, MSG>where
APP: Application<MSG> + 'static,
MSG: 'static,
pub fn add_event_listeners<APP, MSG>( event_listeners: Vec<Attribute<MSG>> ) -> Cmd<APP, MSG>where APP: Application<MSG> + 'static, MSG: 'static,
attach an event listender to the window
sourcepub fn on_resize<F, APP, MSG>(cb: F) -> Cmd<APP, MSG>where
F: Fn(i32, i32) -> MSG + Clone + 'static,
MSG: 'static,
APP: Application<MSG> + 'static,
pub fn on_resize<F, APP, MSG>(cb: F) -> Cmd<APP, MSG>where F: Fn(i32, i32) -> MSG + Clone + 'static, MSG: 'static, APP: Application<MSG> + 'static,
Creates a Cmd in which the MSG will be emitted whenever the browser is resized
sourcepub fn on_hashchange<F, APP, MSG>(cb: F) -> Cmd<APP, MSG>where
F: Fn(String) -> MSG + Clone + 'static,
MSG: 'static,
APP: Application<MSG> + 'static,
pub fn on_hashchange<F, APP, MSG>(cb: F) -> Cmd<APP, MSG>where F: Fn(String) -> MSG + Clone + 'static, MSG: 'static, APP: Application<MSG> + 'static,
attached a callback and will be triggered when the hash portion of the window location url is changed
sourcepub fn get_hash() -> String
pub fn get_hash() -> String
return the hash part of the browser current url location
The hash part are the text right after the #
sign
sourcepub fn scroll_to_top<APP, MSG>() -> Cmd<APP, MSG>where
APP: Application<MSG> + 'static,
MSG: 'static,
pub fn scroll_to_top<APP, MSG>() -> Cmd<APP, MSG>where APP: Application<MSG> + 'static, MSG: 'static,
scroll the browser to the top of the document
sourcepub fn set_location_hash(hash: &str)
pub fn set_location_hash(hash: &str)
set the browser location hash
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl UnwindSafe for Window
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more