JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test">Idle</div>
JavaScript
var div;
// first.js
jQuery(function() {
// Wait for...
jQuery.holdReady(true);
// Set some data
div = jQuery('div#test');
div.text('Waiting...');
// After 2.5s continues
setTimeout(function() {
// If is done before time, so fail!
if(div.text() === 'Done!') {
div.text('Fail!');
}
jQuery.holdReady(false);
}, 2500);
});
// second.js
jQuery(function() {
div.text('Done!');
});
// Need:
// 1. Set "Idle" text by HTML
// 2. Set to "Waiting..." by first.js
// 3. Set to "Done!" by second.js after 2.5 seconds
// Fail if "Done!" is set before 2.5 seconds (you need wait 2.5 seconds!).