From bbd80ccf4f693632c190ba92ecafd64131069688 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 27 Jun 2012 14:55:49 +0200 Subject: [PATCH] Ox.getAsync: fix docs, rename var --- source/Ox/js/Request.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/Ox/js/Request.js b/source/Ox/js/Request.js index fb7e0b75..0199d868 100644 --- a/source/Ox/js/Request.js +++ b/source/Ox/js/Request.js @@ -30,17 +30,24 @@ Ox.get = function(url, callback) { /*@ Ox.getAsync Runs an asynchonous loader for an array of URLs - (urls, map, callback) -> undefined + (urls, get, callback) -> undefined urls URL or array of either URLs or arrays of URLs Multiple URLs in the same array will be processed simultaneously, but multiple arrays of URLs will be processed in that order. + get Asynchronous function that loads a URL (for example Ox.get) + url URL + callback Callback function + result Result + error Error, or null + code Status code + text Status text callback Callback function results Results Keys are file names, values are results errors Errors, or null Keys are file names, values are error objects @*/ -Ox.getAsync = function(urls, map, callback) { +Ox.getAsync = function(urls, get, callback) { urls = Ox.clone(Ox.makeArray(urls)); var errors = {}, i = 0, n = urls.length, results = {}; function done() { @@ -63,7 +70,7 @@ Ox.getAsync = function(urls, map, callback) { iterate(); } else { urls.forEach(function(url) { - map(url, function(result, error) { + get(url, function(result, error) { Ox.extend(results, url, result); Ox.extend(errors, url, error); ++i == n && done();