mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-07-11 00:40:19 +08:00
cleanup data_as_a_function code
This commit is contained in:
+15
-5
@@ -136,13 +136,22 @@ function EventManager(options, _sources) {
|
||||
var success = source.success;
|
||||
var error = source.error;
|
||||
var complete = source.complete;
|
||||
var custom_data;
|
||||
|
||||
// retrieve any outbound GET/POST $.ajax data from the options
|
||||
var customData;
|
||||
if ($.isFunction(source.data)) {
|
||||
custom_data = source.data();
|
||||
} else {
|
||||
custom_data = source.data;
|
||||
// supplied as a function that returns a key/value object
|
||||
customData = source.data();
|
||||
}
|
||||
var data = $.extend({}, custom_data || {});
|
||||
else {
|
||||
// supplied as a straight key/value object
|
||||
customData = source.data;
|
||||
}
|
||||
|
||||
// use a copy of the custom data so we can modify the parameters
|
||||
// and not affect the passed-in object.
|
||||
var data = $.extend({}, customData || {});
|
||||
|
||||
var startParam = firstDefined(source.startParam, options.startParam);
|
||||
var endParam = firstDefined(source.endParam, options.endParam);
|
||||
if (startParam) {
|
||||
@@ -151,6 +160,7 @@ function EventManager(options, _sources) {
|
||||
if (endParam) {
|
||||
data[endParam] = Math.round(+rangeEnd / 1000);
|
||||
}
|
||||
|
||||
pushLoading();
|
||||
$.ajax($.extend({}, ajaxDefaults, source, {
|
||||
data: data,
|
||||
|
||||
Reference in New Issue
Block a user