$.xhr -> $.ajax
This commit is contained in:
parent
ef086934f1
commit
8fcb23d7b2
@ -314,11 +314,14 @@
|
||||
$.add(d.head, script);
|
||||
return $.rm(script);
|
||||
},
|
||||
xhr: function(url, cb) {
|
||||
ajax: function(url, cb, type) {
|
||||
var r;
|
||||
if (type == null) {
|
||||
type = 'get';
|
||||
}
|
||||
r = new XMLHttpRequest();
|
||||
r.onload = cb;
|
||||
r.open('get', url, true);
|
||||
r.open(type, url, true);
|
||||
r.send();
|
||||
return r;
|
||||
},
|
||||
@ -331,7 +334,7 @@
|
||||
return req.callbacks.push(cb);
|
||||
}
|
||||
} else {
|
||||
req = $.xhr(url, (function() {
|
||||
req = $.ajax(url, (function() {
|
||||
var cb, _i, _len, _ref, _results;
|
||||
_ref = this.callbacks;
|
||||
_results = [];
|
||||
@ -1816,7 +1819,7 @@
|
||||
}
|
||||
url = location.pathname + '?' + Date.now();
|
||||
cb = updater.cb.update;
|
||||
return updater.request = $.xhr(url, cb);
|
||||
return updater.request = $.ajax(url, cb);
|
||||
}
|
||||
};
|
||||
watcher = {
|
||||
|
||||
@ -219,10 +219,10 @@ $.extend $,
|
||||
textContent: "(#{code})()"
|
||||
$.add d.head, script
|
||||
$.rm script
|
||||
xhr: (url, cb) ->
|
||||
ajax: (url, cb, type='get') ->
|
||||
r = new XMLHttpRequest()
|
||||
r.onload = cb
|
||||
r.open 'get', url, true
|
||||
r.open type, url, true
|
||||
r.send()
|
||||
r
|
||||
cache: (url, cb) ->
|
||||
@ -232,7 +232,7 @@ $.extend $,
|
||||
else
|
||||
req.callbacks.push cb
|
||||
else
|
||||
req = $.xhr url, (-> cb.call @ for cb in @callbacks)
|
||||
req = $.ajax url, (-> cb.call @ for cb in @callbacks)
|
||||
req.callbacks = [cb]
|
||||
$.cache.requests[url] = req
|
||||
cb:
|
||||
@ -1489,7 +1489,7 @@ updater =
|
||||
updater.request?.abort()
|
||||
url = location.pathname + '?' + Date.now() # fool the cache
|
||||
cb = updater.cb.update
|
||||
updater.request = $.xhr url, cb
|
||||
updater.request = $.ajax url, cb
|
||||
|
||||
watcher =
|
||||
init: ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user