[−][src]Struct stdweb::web::MutationObserver
Provides a way to receive notifications about changes to the DOM.
Methods
impl MutationObserver
[src]
pub fn new<F>(callback: F) -> MutationObserverHandle where
F: FnMut(Vec<MutationRecord>, Self) + 'static,
[src]
F: FnMut(Vec<MutationRecord>, Self) + 'static,
Returns a new MutationObserverHandle
with the given callback.
The callback will be called with the following arguments when the observed DOM nodes change:
-
A vector of changes to the observed DOM nodes.
-
The
MutationObserver
.
pub fn observe<T: INode>(
&self,
target: &T,
options: MutationObserverInit
) -> Result<(), TODO>
[src]
&self,
target: &T,
options: MutationObserverInit
) -> Result<(), TODO>
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
-
At least one of
child_list
,attributes
, orcharacter_data
must betrue
. -
If
attribute_old_value
istrue
, thenattributes
must betrue
. -
If
character_data_old_value
istrue
, thencharacter_data
must betrue
. -
If
attribute_filter
isSome
, thenattributes
must betrue
.
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.
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.
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.
fn try_from(value: MutationObserver) -> Result<Self, Self::Error>
[src]
impl TryFrom<Reference> for MutationObserver
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: Reference) -> Result<Self, Self::Error>
[src]
impl<'_r> TryFrom<&'_r Reference> for MutationObserver
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: &Reference) -> Result<Self, Self::Error>
[src]
impl TryFrom<Value> for MutationObserver
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error>
[src]
impl<'_r> TryFrom<&'_r Value> for MutationObserver
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &Value) -> Result<Self, Self::Error>
[src]
impl InstanceOf for MutationObserver
[src]
fn instance_of(reference: &Reference) -> bool
[src]
impl ReferenceType for MutationObserver
[src]
unsafe fn from_reference_unchecked(reference: Reference) -> Self
[src]
impl Eq for MutationObserver
[src]
impl Clone for MutationObserver
[src]
fn clone(&self) -> MutationObserver
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<MutationObserver> for MutationObserver
[src]
fn eq(&self, other: &MutationObserver) -> bool
[src]
fn ne(&self, other: &MutationObserver) -> bool
[src]
impl AsRef<Reference> for MutationObserver
[src]
impl From<MutationObserver> for Reference
[src]
fn from(value: MutationObserver) -> Self
[src]
impl Debug for MutationObserver
[src]
Auto Trait Implementations
impl Send for MutationObserver
impl Sync for MutationObserver
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,