1.0.7 • Published 5 years ago

mag-data-cacher v1.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Data Cacher

build status npm version dependencies status devDependencies status Gitter

Caches data in a predetermined range.

Installation

npm install mag-data-cacher

Usage

Add the constructor to the scope:

var DataCacher = require('mag-data-cacher');

Create instance with custom config:

var dataCacher = new DataCacher({
        pageSize: 7,
        cacheSize: 2,
        request: {},
        getter: function ( callback, config, count ) {
            //
        }
    });

To check and get data for next page:

var callback = function ( error, receivedData ) {
    console.log(error);
    console.log(receivedData);
};

dataCacher.checkPrev(callback);

To check and get data for previous page:

dataCacher.checkNext(callback);

To check and get data for 1st page:

dataCacher.goHome(callback);

To check and get data for last page:

dataCacher.goEnd(callback);

To refresh data:

dataCacher.refreshData(callback);

Contribution

If you have any problems or suggestions please open an issue according to the contribution rules.

License

mag-data-cacher is released under the MIT License.

1.0.7

5 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago