0.0.1-beta.0 • Published 9 months ago
@zhengxy/exposure v0.0.1-beta.0
exposure
A set of web automatic exposure buried point solutions. when page load, the plugin will auto call the callback function if dom intersection. in the callback,you can collect data for reporting.
Features
- 🚀 1KB Component average size
- 🚀 Native script
- 🚀 Zero third-party dependencies
- 💪 Written in TypeScript
- 📖 Extensive documentation and demos
- 🍭 Support all project
- 🍭 Support Tree Shaking
Installation
npm i @zhengxy/exposure
Using yarn
yarn add @zhengxy/exposure;
Using pnpm
pnpm add @zhengxy/exposure;
Quickstart
Using ESM
// import Api
import Exposure from "@zhengxy/exposure";
Using CommonJs
const Exposure = require("@zhengxy/exposure");
Using iife
<script src="pathto/dist/index.browser.js"></script>
Getting Started
const dom = document.getElementsById("elementId");
const exposure = new Exposure();
dom.addEventListener("click",add)
function add() {
let a = 1;
exposure.observe(ds.item(3),()=>{
console.log(a);
});
}
Browser support
We use interactionObvser
api for support, if you want use in some very old browsers,The easiest way to load the IntersectionObserver polyfill and have it work in the widest range of browsers is via polyfill.io, which will automatically include dependencies where necessary:
<script src="https://polyfill.io/v3/polyfill.min.js?features=IntersectionObserver"></script>
With these polyfills, IntersectionObserver has been tested and known to work in the following browsers:
0.0.1-beta.6
9 months ago
0.0.1-beta.5
9 months ago
0.0.1-beta.4
9 months ago
0.0.1-beta.3
9 months ago
0.0.1-beta.2
9 months ago
0.0.1-beta.1
9 months ago
0.0.1-beta.0
10 months ago