How to use the @hpcc-js/util.AsyncOrderedQueue function in @hpcc-js/util

To help you get started, we’ve selected a few @hpcc-js/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hpcc-systems / Visualization / tests / test-util / src / debounce.spec.ts View on Github external
it("reverse order", async function (): Promise {
        const q = new AsyncOrderedQueue();
        let currID = 0;
        return Promise.all([
            q.push(doStuff(1, 400)).then(id => {
                expect(currID).to.equal(0);
                currID = id;
            }),
            q.push(doStuff(2, 300)).then(id => {
                expect(currID).to.equal(1);
                currID = id;
            }),
            q.push(doStuff(3, 200)).then(id => {
                expect(currID).to.equal(2);
                currID = id;
            }),
            q.push(doStuff(4, 100)).then(id => {
                expect(currID).to.equal(3);