JSFiddle - React, Tailwind, and code Playground

HTML

<button>Are we done yet ?</button>
<br /><br />
<div id="res"></div>
<br /><br />
<div id="time-out-1"><span></span></div>
<div id="time-out-2"><span></span></div>

JavaScript

(function(w) {
     var active = {};

     var _setTimeout = w.setTimeout;
     var _clearTimeout = w.clearTimeout;

     w.setTimeout = function(fn, delay) {
         var id = _setTimeout(function() {
             fn();
             delete active[id];
         }, delay);
         active[id] = true;
         return id;
     }

     w.clearTimeout = function(id) {
         delete active[id];
         _clearTimeout(id);
     }

     w.activeTimers = function() {
         return Object.keys(active).length > 0;
     }
})(window);

setTimeout(function () {
    $("#time-out-1 span").text("Finished 1 !");
},2000);


setTimeout(function () {
    $("#time-out-2 span").text("Finished 2 !");
},4000);

$('button').click(function(){
    if ( window.activeTimers() ) {
        $('#res').html('Not yet!');
    } else {
        $('#res').html('Yes we are!');
    }
});