request methods: don't throw if no callback is passed

This commit is contained in:
rolux 2013-11-30 19:40:27 +01:00
parent cc454e5f80
commit 16b6811b75

View file

@ -51,7 +51,7 @@ Ox.getAsync = function(urls, get, callback) {
urls = Ox.clone(Ox.makeArray(urls));
var errors = {}, i = 0, n = urls.length, results = {};
function done() {
callback(
callback && callback(
n == 1 ? results[urls[0]] : results,
n == 1 ? errors[urls[0]] : Ox.some(errors, function(error) {
return error !== null;
@ -214,9 +214,7 @@ Ox.getJSONC <f> Get and parse a remote JSONC file
For multiple URLs, keys are file names, values are error objects
@*/
Ox.getJSONC = function(url, callback) {
Ox.getJSON(url, function(results, errors) {
callback(results, errors);
}, true);
Ox.getJSON(url, callback, true);
};
/*@