periodic.js

1.1.0 • Public • Published

periodic.js

Install

  • npm install --save periodic.js

Usage

import PeriodicJS from 'periodic.js';
 
const displaySelector = '.periodic';
const periodic = PeriodicJS({
    duration: 3000,
    displaySelector,
    callback: fetchData
});
 
function fetchData(done) {
 
    // tell user we are fetching data
    var element = document.querySelector(displaySelector);
    element.innerHTML = 'updating';
 
    setTimeout(done, 3000);
}
 

Also add an element with the displaySelector class you provided earlier:

<p class='periodic'></p>

Readme

Keywords

Package Sidebar

Install

npm i periodic.js

Weekly Downloads

0

Version

1.1.0

License

MIT

Last publish

Collaborators

  • gabrielflorit