UNPKG

domtranslator

Version:
20 lines (18 loc) 681 B
import { NodesIntersectionObserver } from './utils/NodesIntersectionObserver'; /** * Scheduler for DOM translation that trigger callbacks only for visible nodes. * If node is not visible, callback will be triggered once node will intersect viewport. */ export class IntersectionScheduler { intersectionObserver; constructor(intersectionConfig) { this.intersectionObserver = new NodesIntersectionObserver(intersectionConfig); } add(node, callback) { this.intersectionObserver.observe(node, callback); } remove(node) { this.intersectionObserver.unobserve(node); } } //# sourceMappingURL=sourcemaps/IntersectionScheduler.js.map