selectors-observer

1.0.0 • Public • Published

selectors-observer

可以快速获取用户正在阅读内容的锚点的工具库,框架通用

install

yarn add selectors-observer

or

npm install selectors-observer

demo

import SelectorsObserver from 'selectors-observer';

const selectors = ['#anchor1', '#anchor2', '#anchor3'];

const oberver = new SelectorsObserver();

oberver.select(selectors).listen((selecor) => {
  // 每次正在浏览的锚点变更时,会触发listen
  setViewing(selecor);
});

Dependencies (0)

    Dev Dependencies (5)

    Package Sidebar

    Install

    npm i selectors-observer

    Weekly Downloads

    0

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    5.28 kB

    Total Files

    4

    Last publish

    Collaborators

    • yrobot