A lightweight way to calm noisy event streams

EventMergerJS started from a very practical problem: some update sources are too chatty to handle one event at a time, but simply dropping events loses useful information. This library reduces the noise while still keeping the final state and accumulated intent intact.

Open source JavaScript utility Demo available

What problem it solves

In UI code, network traffic, or simulation-style updates, it is common to get bursts of repeated events that all represent nearly the same thing. EventMergerJS lets me buffer those bursts into a smaller number of handled updates, while still preserving the last meaningful payload and the combined incremental value that matters to the caller.

Usage style

The library is intentionally small. You create a merger with a handler and buffering window, then feed events into it as they arrive.

const merger = new EventMerger((eventName, totalValue, lastValue) => {
    render(lastValue);
}, 40, 120);

merger.add('slider', 1, currentValue);

The included demo makes this behavior easy to see: repeated inputs are merged, the output updates more cleanly, and the log shows how many events were absorbed into one handled result.

Why I keep it around

It is a small utility, but it fits a recurring need. When I want something between “process everything immediately” and “throw updates away,” this gives me a controlled middle ground that stays easy to reason about.

Browse more projects