Просмотр исходного кода

Added the 'eventTransform' option to allow event transformations coming from a JSON event source.

Joe Esposito 14 лет назад
Родитель
Сommit
d7786d4ca6
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      src/EventManager.js

+ 4 - 1
src/EventManager.js

@@ -122,6 +122,7 @@ function EventManager(options, _sources) {
 			}
 		}else{
 			var url = source.url;
+			var eventTransform = source.eventTransform || options.eventTransform;
 			if (url) {
 				var success = source.success;
 				var error = source.error;
@@ -144,7 +145,9 @@ function EventManager(options, _sources) {
 						if ($.isArray(res)) {
 							events = res;
 						}
-						callback(events);
+						callback(events && eventTransform
+							? $.map(events, eventTransform)
+							: events);
 					},
 					error: function() {
 						applyAll(error, this, arguments);