lib/assets/javascripts/up/proxy.js.coffee in upjs-rails-0.18.1 vs lib/assets/javascripts/up/proxy.js.coffee in upjs-rails-0.19.0
- old
+ new
@@ -229,11 +229,11 @@
If a network connection is attempted, the proxy will emit
a `up:proxy:load` event with the `request` as its argument.
Once the response is received, a `up:proxy:receive` event will
be emitted.
- @function up.proxy.ajax
+ @function up.ajax
@param {String} request.url
@param {String} [request.method='GET']
@param {String} [request.target='body']
@param {Boolean} [request.cache]
Whether to use a cached response, if available.
@@ -339,11 +339,11 @@
busyDelayTimer = setTimeout(emission, config.busyDelay)
else
emission()
###*
- This event is [emitted]/(up.emit) when [AJAX requests](/up.proxy.ajax)
+ This event is [emitted]/(up.emit) when [AJAX requests](/up.ajax)
are taking long to finish.
By default Up.js will wait 300 ms for an AJAX request to finish
before emitting `up:proxy:busy`. You can configure this time like this:
@@ -364,11 +364,11 @@
if idle() && busyEventEmitted
up.emit('up:proxy:idle', message: 'Proxy is idle')
busyEventEmitted = false
###*
- This event is [emitted]/(up.emit) when [AJAX requests](/up.proxy.ajax)
+ This event is [emitted]/(up.emit) when [AJAX requests](/up.ajax)
have [taken long to finish](/up:proxy:busy), but have finished now.
@event up:proxy:idle
@stable
###
@@ -396,10 +396,11 @@
# and cache key logic.
request = u.copy(request)
request.headers ||= {}
request.headers['X-Up-Target'] = request.target
+
request.data = u.requestDataAsArray(request.data)
if u.contains(config.wrapMethods, request.method)
request.data.push
name: config.wrapMethodParam
@@ -420,22 +421,22 @@
promise = load(entry.request)
promise.done (args...) -> entry.deferred.resolve(args...)
promise.fail (args...) -> entry.deferred.reject(args...)
###*
- This event is [emitted]/(up.emit) before an [AJAX request](/up.proxy.ajax)
+ This event is [emitted]/(up.emit) before an [AJAX request](/up.ajax)
is starting to load.
@event up:proxy:load
@param event.url
@param event.method
@param event.target
@experimental
###
###*
- This event is [emitted]/(up.emit) when the response to an [AJAX request](/up.proxy.ajax)
+ This event is [emitted]/(up.emit) when the response to an [AJAX request](/up.ajax)
has been received.
@event up:proxy:received
@param event.url
@param event.method
@@ -514,5 +515,7 @@
busy: busy
config: config
defaults: -> u.error('up.proxy.defaults(...) no longer exists. Set values on he up.proxy.config property instead.')
)(jQuery)
+
+up.ajax = up.proxy.ajax