1.0.2 • Published 5 years ago
rxjs-web-observers v1.0.2
rxjs-web-observers
This library allows you to use MutationObserver, IntersectionObserver, ResizeObserver like RxJs observer.
Install
npm install --save rxjs-web-observers
Polyfills
Recommended polyfills:
- MutationObserver
- IntersectionObserver
- ResizeObserver polyfill based on latest specification which includes support for observer options (recommended)
- ResizeObserver polyfill based on initial specification
Usage
Creating MutationObserver
from call fromMutation
function:
import { fromMutation } from 'rxjs-web-observers';
const source$ = fromMutation(
observedEl, // some observed element
{ childList: true } // observer options
);
source$.subscribe(mutations => {
// your code...
});
Creation IntersectionObserver
by fromIntersection
function:
import { fromIntersection } from 'rxjs-web-observers';
const source$ = fromIntersection(
observedEl, // some observed element
);
source$.subscribe(entries => {
// your code...
});
Creation ResizeObserver
by fromResize
function:
import { fromResize } from 'rxjs-web-observers';
const source$ = fromResize(
observedEl, // some observed element
);
source$.subscribe(entries => {
// your code...
});