@amraneze/sliding-window
v1.0.0
Published
A NPM module that handle sliding window. You can use it if you have a certain time before processing a certain data
Downloads
4
Maintainers
Readme
Sliding Window Module
Sliding Window is an npm module which does not process data while the queue is full.
NOTE: For each 500 ms the module is checking if the duration of each element of the queue exceeded the time limit (which is the window slide).
Installation
With NPM
$ npm install sliding-windowWith Yarn
$ yarn add sliding-windowUsage
You should import the module after installing it with npm/yarn
import WindowSliding from 'sliding-window';
const windowSliding = new WindowSliding(60 * 1000, 10);There are two paramaters in the constructor, the first one to define the time limit in seconds and the second for the maximum data that can be processed within the time limit.
Building
You can pull the project and run the following command to install the dependencies of the project:
With NPM
$ npm installWith Yarn
$ yarn installthen this command to build it:
With NPM
$ npm run buildWith Yarn
$ yarn run buildTesting
With NPM
$ npm run testWith Yarn
$ yarn run testContributions
Contributions are always welcome via pull requests.
