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