Page MenuHomestyx hydra

Busy.js
No OneTemporary

/**
* @requires javelin-install
* javelin-dom
* javelin-fx
* @provides phabricator-busy
* @javelin
*/
/**
* Show a "busy" indicator onscreen so the user knows something awesome is
* happening, and that the awesome thing isn't the application breaking or
* locking up.
*
* Example usage:
*
* JX.Busy.start();
* // Do something...
* JX.Busy.done();
*
* Calls to `start()` should be paired with calls to `done()`.
*/
JX.install('Busy', {
statics : {
_depth : 0,
start : function() {
var self = JX.Busy;
if (!self._depth) {
self._indicator = JX.$N('div', {className: 'busy'});
self._indicator.style.opacity = 0;
document.body.appendChild(self._indicator);
// Don't actually show the indicator for a little while, to prevent
// it from flashing briefly for every Ajax request.
new JX.FX(self._indicator).setDuration(1000).start({opacity: [0, 0.8]});
}
self._depth++;
},
done : function() {
var self = JX.Busy;
--self._depth;
if (!self._depth) {
JX.DOM.remove(self._indicator);
self._indicator = null;
}
}
}
});

File Metadata

Mime Type
text/plain
Expires
Tue, Jul 29, 1:32 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
187736
Default Alt Text
Busy.js (1 KB)

Event Timeline