Delays loading spinner when switching between tabs.

This commit is contained in:
Wojciech Zawistowski 2014-03-31 17:56:23 +02:00
parent d84b2b5117
commit a561cbc5fa

View File

@ -10,11 +10,18 @@
Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.OpenComposer, {
actions: {
loading: function() {
this.controllerFor('discovery').set('loading', true);
var controller = this.controllerFor('discovery');
controller.set('scheduledSpinner', Ember.run.later(controller, function() {
this.set('loading', true);
},500));
},
loadingComplete: function() {
this.controllerFor('discovery').set('loading', false);
var controller = this.controllerFor('discovery');
Ember.run.cancel(controller.get('scheduledSpinner'));
controller.set('loading', false);
},
didTransition: function() {