luske

Processing multiplexer/batcher


License
GPL-2.0
Install
npm install luske@0.2.2

Documentation

Luske

Processing multiplexer/batcher

Inspired by DataLoader, but with time based loading trigger.

Example usage:


function batchingFunc(args) {
    // Load up your data in your custom batching way. In this case, we are not
    // picky, we just return the arguments.
    return args;
}

const loader = new Luske(batchingFunc, {
    // How long to wait on new load requests before loading (default 100ms)
    timeoutMs: 100,
    // Max number of unique loading requests before loading (default no limit)
    batchSize: 10,
});

const promise1 = loader.load(1);
const promise2 = loader.load(2);
// ...