JSFiddle - React, Tailwind, and code Playground

by Steven Senkus

HTML

<div id="result"></div>

JavaScript

var timer;
 
(function process() {
  $('#result').html('waiting…');
  var deferred = $.Deferred();
     
  timer = setInterval(function() {
    deferred.notify();
  }, 1000);
   
  setTimeout(function() {
     clearInterval(timer);
     deferred.resolve();
  }, 10000);
   
  return deferred.promise();
})().then(function() { $('#result').html('done.'); },
          null,
          function() { $('#result').html($('#result').html() + '.'); });