Struct script::dom::intersectionobserver::IntersectionObserver
source · #[repr(C)]pub struct IntersectionObserver {
reflector_: Reflector,
callback: Rc<IntersectionObserverCallback>,
}
Expand description
The Intersection Observer interface
The IntersectionObserver interface can be used to observe changes in the intersection of an intersection root and one or more target Elements.
https://w3c.github.io/IntersectionObserver/#intersection-observer-interface
Fields§
§reflector_: Reflector
§callback: Rc<IntersectionObserverCallback>
This callback will be invoked when there are changes to a target’s intersection with the intersection root, as per the processing model. https://w3c.github.io/IntersectionObserver/#intersection-observer-callback
Implementations§
source§impl IntersectionObserver
impl IntersectionObserver
fn __assert_parent_type(&self)
source§impl IntersectionObserver
impl IntersectionObserver
pub fn new_inherited( callback: Rc<IntersectionObserverCallback>, _init: &IntersectionObserverInit, ) -> Self
fn new( window: &Window, proto: Option<HandleObject<'_>>, callback: Rc<IntersectionObserverCallback>, init: &IntersectionObserverInit, can_gc: CanGc, ) -> Root<Dom<Self>>
Trait Implementations§
source§impl DomObject for IntersectionObserver
impl DomObject for IntersectionObserver
source§impl DomObjectWrap for IntersectionObserver
impl DomObjectWrap for IntersectionObserver
source§const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::IntersectionObserverBinding::IntersectionObserver_Binding::Wrap as for<'a, 'b> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::intersectionobserver::IntersectionObserver>, script_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::intersectionobserver::IntersectionObserver>>}
const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::IntersectionObserverBinding::IntersectionObserver_Binding::Wrap as for<'a, 'b> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::intersectionobserver::IntersectionObserver>, script_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::intersectionobserver::IntersectionObserver>>}
source§impl HasParent for IntersectionObserver
impl HasParent for IntersectionObserver
source§impl IDLInterface for IntersectionObserver
impl IDLInterface for IntersectionObserver
source§impl IntersectionObserverMethods<DomTypeHolder> for IntersectionObserver
impl IntersectionObserverMethods<DomTypeHolder> for IntersectionObserver
source§fn GetRoot(&self) -> Option<ElementOrDocument>
fn GetRoot(&self) -> Option<ElementOrDocument>
The root provided to the IntersectionObserver constructor, or null if none was provided.
https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-root
source§fn RootMargin(&self) -> DOMString
fn RootMargin(&self) -> DOMString
Offsets applied to the root intersection rectangle, effectively growing or shrinking the box that is used to calculate intersections. These offsets are only applied when handling same-origin-domain targets; for cross-origin-domain targets they are ignored.
https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-rootmargin
source§fn ScrollMargin(&self) -> DOMString
fn ScrollMargin(&self) -> DOMString
Offsets are applied to scrollports on the path from intersection root to target, effectively growing or shrinking the clip rects used to calculate intersections.
https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-scrollmargin
source§fn Thresholds(&self, _context: JSContext, _retval: MutableHandleValue<'_>)
fn Thresholds(&self, _context: JSContext, _retval: MutableHandleValue<'_>)
A list of thresholds, sorted in increasing numeric order, where each threshold is a ratio of intersection area to bounding box area of an observed target. Notifications for a target are generated when any of the thresholds are crossed for that target. If no options.threshold was provided to the IntersectionObserver constructor, or the sequence is empty, the value of this attribute will be [0].
https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-thresholds
source§fn Delay(&self) -> i32
fn Delay(&self) -> i32
A number indicating the minimum delay in milliseconds between notifications from this observer for a given target.
https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-delay
source§fn TrackVisibility(&self) -> bool
fn TrackVisibility(&self) -> bool
A boolean indicating whether this IntersectionObserver will track changes in a target’s visibility.
https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-trackvisibility
source§fn Observe(&self, _target: &Element)
fn Observe(&self, _target: &Element)
Run the observe a target Element algorithm, providing this and target.
https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-observe
source§fn Unobserve(&self, _target: &Element)
fn Unobserve(&self, _target: &Element)
Run the unobserve a target Element algorithm, providing this and target.
https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-unobserve
source§fn Disconnect(&self)
fn Disconnect(&self)
source§fn TakeRecords(&self) -> Vec<Root<Dom<IntersectionObserverEntry>>>
fn TakeRecords(&self) -> Vec<Root<Dom<IntersectionObserverEntry>>>
source§fn Constructor(
window: &Window,
proto: Option<HandleObject<'_>>,
can_gc: CanGc,
callback: Rc<IntersectionObserverCallback>,
init: &IntersectionObserverInit,
) -> Root<Dom<IntersectionObserver>>
fn Constructor( window: &Window, proto: Option<HandleObject<'_>>, can_gc: CanGc, callback: Rc<IntersectionObserverCallback>, init: &IntersectionObserverInit, ) -> Root<Dom<IntersectionObserver>>
source§impl MallocSizeOf for IntersectionObserver
impl MallocSizeOf for IntersectionObserver
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl MutDomObject for IntersectionObserver
impl MutDomObject for IntersectionObserver
source§impl PartialEq for IntersectionObserver
impl PartialEq for IntersectionObserver
source§impl Traceable for IntersectionObserver
impl Traceable for IntersectionObserver
impl Eq for IntersectionObserver
Auto Trait Implementations§
impl !Freeze for IntersectionObserver
impl !RefUnwindSafe for IntersectionObserver
impl !Send for IntersectionObserver
impl !Sync for IntersectionObserver
impl Unpin for IntersectionObserver
impl !UnwindSafe for IntersectionObserver
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more