@alegendstale/holly-components
Version:
Reusable UI components created using lit
17 lines (16 loc) • 413 B
JavaScript
class r {
constructor(s, t) {
this.host = s, this.isIntersecting = !1, this.host.addController(this), this.observer = new IntersectionObserver(([e]) => {
this.isIntersecting = e.isIntersecting, this.host.requestUpdate();
}, t);
}
hostConnected() {
this.observer.observe(this.host);
}
hostDisconnected() {
this.observer.disconnect();
}
}
export {
r as IntersectionController
};