JSFiddle - React, Tailwind, and code Playground

by Bryson Murray

HTML

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

JavaScript

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