loadImage, keep reference in global scope, use local variables for rest

This commit is contained in:
j 2011-02-01 01:01:15 +05:30
parent 1168abcbb8
commit cfa530c6cb

View file

@ -177,15 +177,17 @@ requires
}
function loadImages(callback) {
window.OxImageCache = [];
$.getJSON(oxui.path + 'json/ox.ui.images.json', function(data) {
var counter = 0,
length = data.length;
data.forEach(function(src, i) {
image = new Image();
var image = new Image();
image.src = oxui.path + src;
image.onload = function() {
(++counter == length) && callback();
}
window.OxImageCache.push(image);
});
});
}