pub struct Window;
Expand description
Provides access to the Browser window
Implementations
sourceimpl Window
impl Window
sourcepub fn add_event_listeners<APP, MSG>(
event_listeners: Vec<Attribute<&'static str, &'static str, AttributeValue<MSG>>, Global>
) -> Cmd<Program<APP, MSG>> where
APP: 'static + Application<MSG>,
MSG: 'static,
pub fn add_event_listeners<APP, MSG>(
event_listeners: Vec<Attribute<&'static str, &'static str, AttributeValue<MSG>>, Global>
) -> Cmd<Program<APP, MSG>> where
APP: 'static + Application<MSG>,
MSG: 'static,
attach an event listender to the window
sourcepub fn on_resize<F, APP, MSG>(cb: F) -> Cmd<Program<APP, MSG>> where
F: 'static + Fn(i32, i32) -> MSG + Clone,
MSG: 'static,
APP: 'static + Application<MSG>,
pub fn on_resize<F, APP, MSG>(cb: F) -> Cmd<Program<APP, MSG>> where
F: 'static + Fn(i32, i32) -> MSG + Clone,
MSG: 'static,
APP: 'static + Application<MSG>,
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<Program<APP, MSG>> where
F: 'static + Fn(String) -> MSG + Clone,
MSG: 'static,
APP: 'static + Application<MSG>,
pub fn on_hashchange<F, APP, MSG>(cb: F) -> Cmd<Program<APP, MSG>> where
F: 'static + Fn(String) -> MSG + Clone,
MSG: 'static,
APP: 'static + Application<MSG>,
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<Program<APP, MSG>> where
APP: 'static,
MSG: 'static,
pub fn scroll_to_top<APP, MSG>() -> Cmd<Program<APP, MSG>> where
APP: '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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more