featherlight
Version:
Featherlight is a very lightweight jQuery lightbox plugin. It's simple yet flexible and easy to use. Featherlight has minimal css and uses no inline styles, everything is name-spaced, it's completely customizable via configuration object and offers image,
34 lines (31 loc) • 784 B
JavaScript
if(!this.chai) { chai = require("chai"); }
var patiently = function(done, blockOrBlocks, maxDelay) {
var self = this,
blocks = typeof blockOrBlocks === 'function' ? [blockOrBlocks] : blockOrBlocks,
block = blocks.shift(),
delay = 200,
maxFailures = (maxDelay || 1000) / delay,
check = function(){
try { block.call(self) }
catch (exc) {
if (exc instanceof chai.AssertionError &&
--maxFailures >= 0) {
setTimeout(check, delay);
return ;
}
throw(exc);
}
block = blocks.shift();
if (block) {
check();
} else {
done();
}
};
check();
}
if (typeof exports == "object") {
module.exports = patiently;
} else {
this["patiently"] = patiently;
};