[][src]Struct stdweb::web::MutationObserver

pub struct MutationObserver(_);

Provides a way to receive notifications about changes to the DOM.

(JavaScript docs)

Methods

impl MutationObserver[src]

pub fn new<F>(callback: F) -> MutationObserverHandle where
    F: FnMut(Vec<MutationRecord>, Self) + 'static, 
[src]

Returns a new MutationObserverHandle with the given callback.

The callback will be called with the following arguments when the observed DOM nodes change:

  1. A vector of changes to the observed DOM nodes.

  2. The MutationObserver.

(JavaScript docs)

pub fn observe<T: INode>(
    &self,
    target: &T,
    options: MutationObserverInit
) -> Result<(), TODO>
[src]

Starts observing changes to the target.

When the target is changed, the MutationObserver is notified with a vector of MutationRecord.

The options specifies which changes should be observed.

Multiple different targets can be observed simultaneously (with the same or different options).

If you call observe on the same target multiple times, it will replace the old options with the new options. It will not notify multiple times for the same change to the same target.

Panics

(JavaScript docs)

pub fn disconnect(&self)[src]

Stops observing all targets.

Until the observe method is called again, the MutationObserver will not be notified of any changes.

(JavaScript docs)

pub fn take_records(&self) -> Vec<MutationRecord>[src]

Empties the MutationObserver's record queue and returns what was in there.

This method is generally not needed, instead use the MutationObserver callback to respond to changes.

(JavaScript docs)

Trait Implementations

impl JsSerialize for MutationObserver[src]

impl TryFrom<MutationObserver> for Reference[src]

type Error = Void

The type returned in the event of a conversion error.

impl TryFrom<Reference> for MutationObserver[src]

type Error = ConversionError

The type returned in the event of a conversion error.

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

type Error = ConversionError

The type returned in the event of a conversion error.

impl TryFrom<Value> for MutationObserver[src]

type Error = ConversionError

The type returned in the event of a conversion error.

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

type Error = ConversionError

The type returned in the event of a conversion error.

impl InstanceOf for MutationObserver[src]

impl ReferenceType for MutationObserver[src]

impl AsRef<Reference> for MutationObserver[src]

impl From<MutationObserver> for Reference[src]

impl Clone for MutationObserver[src]

impl Eq for MutationObserver[src]

impl PartialEq<MutationObserver> for MutationObserver[src]

impl Debug for MutationObserver[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> for T[src]

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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