new SimplePollingObserver(handler, options)
Creates a new SimplePollingObserver, and starts observation.
Parameters:
Name | Type | Description |
---|---|---|
handler |
function | the intersection handler function, that works with given entries |
options |
Object | in IntersectionObserver, this would hold the threshold(s), which we do not need here, but, optionally, you may define the targetFps here, to define polling precision in detail |
- Source:
Methods
connect() → {SimplePollingObserver}
Starts polling elements and calls the intersection handler periodically with newly created entries.
- Source:
Returns:
the observer instance
Example
simplePollingObserver.connect();
disconnect() → {SimplePollingObserver}
Stops polling and removes all observed elements from the observer.
- Source:
Returns:
the observer instance
Example
simplePollingObserver.disconnect();
observe(element) → {SimplePollingObserver}
Adds the element to the set of observed elements, for which entries are created, that are, in-term, given to the intersection handler.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | the element to observe |
- Source:
Returns:
the observer instance
Example
simplePollingObserver.observe(teaserElement);
unobserve(element) → {SimplePollingObserver}
Removes the element from the set of observed elements.
Parameters:
Name | Type | Description |
---|---|---|
element |
HTMLElement | the element to unobserve |
- Source:
Returns:
the observer instance
Example
simplePollingObserver.unobserve(teaserElement);