nearly zero-cost bind IntersectionObserver
Run the following in your favorit console:
> yarn add @ri7nz/rescript-intersection-observerOR
> npm install --save @ri7nz/rescript-intersection-observerThen, add @ri7nz/rescript-intersection-observer in your bsconfig.json:
-- "bs-dependencies": [],
++ "bs-dependencies": ["@ri7nz/rescript-intersection-observer"],open Intersection
// construct
let observer = ObserverEntry.new(entries => {
// implement your observe here
})
// observe
observer->Observer.observe(targetDOMElement)
// unobserve
observer->Observer.unobserve(targetDOMElement)
Or you can check this examples.
TODO: docs for API
- Intersection.Observer
- Intersection.ObserverEntry
