A debouncer library based on microtasks.
You can try the demo here.
npm i nexbounce
You can find documentation here.
import { Debouncer } from 'nexbounce/nexbounce.js';
let counter = 0;
const debouncer = new Debouncer();
nexbounce.enqueue(() => (counter += 3));
nexbounce.enqueue(() => (counter += 1));
nexbounce.enqueue(() => (counter += 2));
setTimeout(() => console.log(counter)); // 2