Struct stdweb::web::MutationObserver [−][src]
pub struct MutationObserver(_);
Provides a way to receive notifications about changes to the DOM.
Methods
impl MutationObserver
[src]
impl MutationObserver
pub fn new<F>(callback: F) -> MutationObserverHandle where
F: FnMut(Vec<MutationRecord>, Self) + 'static,
[src]
pub fn new<F>(callback: F) -> MutationObserverHandle where
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]
pub fn observe<T: INode>(
&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]
pub fn disconnect(&self)
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]
pub fn take_records(&self) -> Vec<MutationRecord>
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 Clone for MutationObserver
[src]
impl Clone for MutationObserver
fn clone(&self) -> MutationObserver
[src]
fn clone(&self) -> MutationObserver
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for MutationObserver
[src]
impl Debug for MutationObserver
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for MutationObserver
[src]
impl PartialEq for MutationObserver
fn eq(&self, other: &MutationObserver) -> bool
[src]
fn eq(&self, other: &MutationObserver) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &MutationObserver) -> bool
[src]
fn ne(&self, other: &MutationObserver) -> bool
This method tests for !=
.
impl Eq for MutationObserver
[src]
impl Eq for MutationObserver
impl InstanceOf for MutationObserver
[src]
impl InstanceOf for MutationObserver
fn instance_of(reference: &Reference) -> bool
[src]
fn instance_of(reference: &Reference) -> bool
Checks whenever a given Reference if of type Self
.
impl AsRef<Reference> for MutationObserver
[src]
impl AsRef<Reference> for MutationObserver
impl ReferenceType for MutationObserver
[src]
impl ReferenceType for MutationObserver
unsafe fn from_reference_unchecked(reference: Reference) -> Self
[src]
unsafe fn from_reference_unchecked(reference: Reference) -> Self
Converts a given reference into a concrete reference-like wrapper. Doesn't do any type checking; highly unsafe to use! Read more
impl From<MutationObserver> for Reference
[src]
impl From<MutationObserver> for Reference
fn from(value: MutationObserver) -> Self
[src]
fn from(value: MutationObserver) -> Self
Performs the conversion.
impl TryFrom<MutationObserver> for Reference
[src]
impl TryFrom<MutationObserver> for Reference
type Error = Void
The type returned in the event of a conversion error.
fn try_from(value: MutationObserver) -> Result<Self, Self::Error>
[src]
fn try_from(value: MutationObserver) -> Result<Self, Self::Error>
Performs the conversion.
impl TryFrom<Reference> for MutationObserver
[src]
impl TryFrom<Reference> for MutationObserver
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: Reference) -> Result<Self, Self::Error>
[src]
fn try_from(reference: Reference) -> Result<Self, Self::Error>
Performs the conversion.
impl<'_r> TryFrom<&'_r Reference> for MutationObserver
[src]
impl<'_r> TryFrom<&'_r Reference> for MutationObserver
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: &Reference) -> Result<Self, Self::Error>
[src]
fn try_from(reference: &Reference) -> Result<Self, Self::Error>
Performs the conversion.
impl TryFrom<Value> for MutationObserver
[src]
impl TryFrom<Value> for MutationObserver
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error>
[src]
fn try_from(value: Value) -> Result<Self, Self::Error>
Performs the conversion.
impl<'_r> TryFrom<&'_r Value> for MutationObserver
[src]
impl<'_r> TryFrom<&'_r Value> for MutationObserver
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &Value) -> Result<Self, Self::Error>
[src]
fn try_from(value: &Value) -> Result<Self, Self::Error>
Performs the conversion.
impl JsSerialize for MutationObserver
[src]
impl JsSerialize for MutationObserver
Auto Trait Implementations
impl Send for MutationObserver
impl Send for MutationObserver
impl Sync for MutationObserver
impl Sync for MutationObserver