events-window

A data structure to store and retrieve events, it could only store events that are happened for a short while.

Usage no npm install needed!

<script type="module">
  import eventsWindow from 'https://cdn.skypack.dev/events-window';
</script>

README

events-window

npm The MIT License Type definitions code style: prettier Commitizen friendly

Documentation.

A data structure to store and retrieve events, it only store events that are happened for a short while.

Quick start

import EventsWindow from 'events-window';

const ew = new EventsWindow();

ew.add('good message', Date.now());
ew.add('bad message', Date.now());

for (const [v, t] of ew.events(Date.now() - 2000)) {
    console.log(`receive event ${v} at ${t}`);
}

Installation

npm i events-window;

Development

# test
npm run test:watch
# build
npm run build