From 03163692fd783fb32ed64fbd24132eedddc0b53a Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 19 Apr 2012 14:29:47 +0200 Subject: [PATCH] use Ox.loadFiles --- static/js/pandora.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/static/js/pandora.js b/static/js/pandora.js index 73193697..00ba3f0c 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -177,21 +177,9 @@ appPanel var prefix = '/static/'; if (localStorage && localStorage['pandora.debug']) { Ox.getJSON(prefix + 'json/pandora.json?' + Ox.random(1000), function(files) { - var promises = []; - files.forEach(function(file) { - var dfd = new $.Deferred(); - promises.push(dfd.promise()); - Ox.loadFile(prefix + file, function() { - dfd.resolve(); - }); - }); - $.when.apply(null, promises) - .done(function() { - callback(); - }) - .fail(function() { - throw new Error('File not found.'); - }); + Ox.loadFiles(Ox.map(files, function(file) { + return prefix + file; + }), callback); }); } else { Ox.loadFile(prefix + 'js/pandora.min.js', callback);