Struct sauron_core::dom::Window

source ·
pub struct Window;
Expand description

Provides access to the Browser window

Implementations§

source§

impl Window

source

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

source

pub fn set_title(title: &str)

set the title of the document

source

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

source

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

source

pub fn get_size() -> (i32, i32)

return the size of the browser at this moment

source

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

source

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

source

pub fn set_location_hash(hash: &str)

set the browser location hash

Trait Implementations§

source§

impl Clone for Window

source§

fn clone(&self) -> Window

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Window

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for Window

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.