[][src]Struct stdweb::web::event::PopStateEvent

pub struct PopStateEvent(_);

A PopStateEvent is dispatched to the window every time the active history entry changes between two history entries for the same document. If the history entry being activated was created by a call to history.push_state() or was affected by a call to history.replace_state(), the PopStateEvent's state property contains a copy of the history entry's state object.

Note that just calling history.push_state() or history.replace_state() won't trigger a PopStateEvent. The PopStateEvent is only triggered by doing a browser action such as a clicking on the back button (or calling history.back()). And the event is only triggered when the user navigates between two history entries for the same document.

Browsers tend to handle the PopStateEvent differently on page load. Chrome and Safari always emit a PopStateEvent on page load, but Firefox doesn't.

(Javascript docs)

Methods

impl PopStateEvent[src]

pub fn state(&self) -> Value[src]

The state object associated to the new history entry, if that entry was created with push_state or affected by replace_state.

Example usage:

This example is not tested
let state: Option<MyStruct> = event.state().try_into().ok();

Trait Implementations

impl JsSerialize for PopStateEvent[src]

impl TryFrom<PopStateEvent> for Reference[src]

type Error = Void

The type returned in the event of a conversion error.

impl TryFrom<Reference> for PopStateEvent[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_r> TryFrom<&'_r Reference> for PopStateEvent[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<Value> for PopStateEvent[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl<'_r> TryFrom<&'_r Value> for PopStateEvent[src]

type Error = ConversionError

The type returned in the event of a conversion error.

impl InstanceOf for PopStateEvent[src]

impl ReferenceType for PopStateEvent[src]

impl IEvent for PopStateEvent[src]

fn bubbles(&self) -> bool[src]

Indicates whether this event bubbles upward through the DOM. Read more

fn cancel_bubble(&self) -> bool[src]

A historical alias to Event.stopPropagation(). Read more

fn set_cancel_bubble(&self, value: bool)[src]

A historical alias to Event.stopPropagation(). Setting this to true before returning from an event handler will stop propagation of the event. Read more

fn cancelable(&self) -> bool[src]

Indicates whether the event is cancelable. Read more

fn current_target(&self) -> Option<EventTarget>[src]

A reference to the currently registered target of this event. Read more

fn default_prevented(&self) -> bool[src]

Indicates whether preventDefault has been called on this event. Read more

fn event_phase(&self) -> EventPhase[src]

Indicates which phase of event flow is currently being evaluated. Read more

fn stop_immediate_propagation(&self)[src]

Prevents any further listeners from being called for this event. Read more

fn stop_propagation(&self)[src]

Stops the propagation of this event to descendants in the DOM. Read more

fn target(&self) -> Option<EventTarget>[src]

Returns a reference to the target to which this event was originally registered. Read more

fn time_stamp(&self) -> Option<f64>[src]

Returns the time in milliseconds at which this event was created. Read more

fn is_trusted(&self) -> bool[src]

Indicates whether the event was generated by a user action.

fn event_type(&self) -> String[src]

Returns a string containing the type of event. It is set when the event is constructed and is the name commonly used to refer to the specific event. Read more

fn prevent_default(&self)[src]

Cancels the event if it is cancelable, without stopping further propagation of the event. Read more

impl ConcreteEvent for PopStateEvent[src]

impl From<PopStateEvent> for Reference[src]

impl Eq for PopStateEvent[src]

impl AsRef<Reference> for PopStateEvent[src]

impl PartialEq<PopStateEvent> for PopStateEvent[src]

impl Clone for PopStateEvent[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for PopStateEvent[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]