2.0.0 • Published 7 years ago

timed-reduction-counter v2.0.0

Weekly downloads
2
License
BSD
Repository
-
Last release
7 years ago

Timed Reduction Counter

A simple incrementable counter which reduces the count periodically.

Usage

var trc = new (require('timed-reduction-counter')).TimedReductionCounter({
	limit: 3, // count limit
	interval: 2000 // ms
});

trc.count('key'); // 0 + 1 = 1
trc.count('key', 3) // 1 + 3 = 4
trc.isOverLimit('key'); // true (4)

// wait 2 seconds
setTimeout(() => {
	trc.isOverLimit('key'); // false (3)
}, 2000);

trc.stop(); // clear timer
2.0.0

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago