tick-counter

Count ticks per X seconds

Usage no npm install needed!

<script type="module">
  import tickCounter from 'https://cdn.skypack.dev/tick-counter';
</script>

README

tick-counter

Counts ticks per X seconds

Installation

$ npm install tick-counter

Example

const ticker = new Ticker() // Or use new "Ticker(5000)" for a specific period

setInterval(() => {
    ticker.tick();
}, 250);

setTimeout(() => {
    ticker.terminate()
}, 4000)

ticker.on('ticks', (total) => {
    console.log(total)
})