/**1* @requires javelin-install2* javelin-dom3* javelin-fx4* @provides phabricator-busy5* @javelin6*/78/**9* Show a "busy" indicator onscreen so the user knows something awesome is10* happening, and that the awesome thing isn't the application breaking or11* locking up.12*13* Example usage:14*15* JX.Busy.start();16* // Do something...17* JX.Busy.done();18*19* Calls to `start()` should be paired with calls to `done()`.20*/21JX.install('Busy', {2223statics : {24_depth : 0,25start : function() {26var self = JX.Busy;27if (!self._depth) {28var icon = JX.$N('span',29{className: 'phui-icon-view phui-font-fa fa-gear ph-spin'});30self._indicator = JX.$N('div', {className: 'busy'}, icon);31self._indicator.style.opacity = 0;32JX.$('phabricator-standard-page').appendChild(self._indicator);3334// Don't actually show the indicator for a little while, to prevent35// it from flashing briefly for every Ajax request.3637new JX.FX(self._indicator).setDuration(1000).start({opacity: [0, 0.8]});38}39self._depth++;40},41done : function() {42var self = JX.Busy;43--self._depth;4445if (!self._depth) {46JX.DOM.remove(self._indicator);47self._indicator = null;48}49}50}5152});535455