Parcourir la source

fix loading not being fired

Adam Shaw il y a 8 ans
Parent
commit
81b94586d8

+ 4 - 0
src/models/event-source/FuncEventSource.js

@@ -7,6 +7,8 @@ var FuncEventSource = EventSource.extend({
 	fetch: function(start, end, timezone) {
 		var _this = this;
 
+		this.calendar.pushLoading();
+
 		return Promise.construct(function(onResolve) {
 			_this.func.call(
 				this.calendar,
@@ -14,6 +16,8 @@ var FuncEventSource = EventSource.extend({
 				end.clone(),
 				timezone,
 				function(rawEventDefs) {
+					_this.calendar.popLoading();
+
 					onResolve(_this.parseEventDefs(rawEventDefs));
 				}
 			);

+ 6 - 0
src/models/event-source/JsonFeedEventSource.js

@@ -19,6 +19,8 @@ var JsonFeedEventSource = EventSource.extend({
 		// don't intercept success/error
 		// tho will be a breaking API change
 
+		this.calendar.pushLoading();
+
 		return Promise.construct(function(onResolve, onReject) {
 			$.ajax($.extend(
 				{}, // avoid mutation
@@ -29,6 +31,8 @@ var JsonFeedEventSource = EventSource.extend({
 					success: function(rawEventDefs) {
 						var callbackRes;
 
+						_this.calendar.popLoading();
+
 						if (rawEventDefs) {
 							callbackRes = applyAll(onSuccess, this, arguments); // redirect `this`
 
@@ -43,6 +47,8 @@ var JsonFeedEventSource = EventSource.extend({
 						}
 					},
 					error: function() {
+						_this.calendar.popLoading();
+
 						applyAll(onError, this, arguments); // redirect `this`
 						onReject();
 					}