JSFiddle - React, Tailwind, and code Playground

JavaScript

function Queue(a) {
    var t;

    a.pause = function () {
        clearTimeout(t);
    };
    
    a.resume = function () {
        a.pause();
        t = setTimeout(function () {
            if (a[0]) {
                a.resume();
                a.shift()(a);
            }
        }, 0);
    };

    a.resume();
}

Queue([
    function (q) {
        console.log(1);
    },
    function (q) {
        console.log(2.1);
        q.pause();

        setTimeout(function () {
            console.log(2.2);
            q.resume();
        }, 1000);
    },
    function (q) {
        console.log(3);
    }
]);