rescript-intersection-observer
nearly zero-cost bind IntersectionObserver
Installation
Run the following in your favorit console:
> yarn add @ri7nz/rescript-intersection-observer
OR
> npm install --save @ri7nz/rescript-intersection-observer
Then, add @ri7nz/rescript-intersection-observer
in your bsconfig.json
:
-- "bs-dependencies": [],
++ "bs-dependencies": ["@ri7nz/rescript-intersection-observer"],
Usage
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.
API
TODO: docs for API
- Intersection.Observer
- Intersection.ObserverEntry