@glorious/fyzer
v0.1.10
Published
Listen when some element just appears above the page fold
Downloads
110
Readme
Fyzer
The easiest way to be notified when some element appears above the page fold
Installation
$ npm install -S @glorious/fyzer
Usage
import fyzer from '@glorious/fyzer';
const element = document.querySelector('#myElement');
const subscriptionId = fyzer.subscribe(element, () => {
// This function will be called every time
// element appears above the fold.
});
// When you no longer needs to observe the element's position,
// you can unsubscribe from Fyzer:
fyzer.unsubscribe(subscriptionId);
Contributing
Install Node. Download the "Recommend for Most Users" version.
Clone the repo:
git clone [email protected]:glorious-codes/glorious-fyzer.git
- Go to the project directory:
cd glorious-fyzer
- Install the project dependencies:
npm install
Tests
Ensure that all code that you have added is covered with unit tests:
npm run test -- --coverage