Created
May 29, 2013 13:56
-
-
Save davbo/5670438 to your computer and use it in GitHub Desktop.
Replaces any preloaded images with locally cached version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['underscore'], function(_) { | |
return { | |
replace: function (images) { | |
// Look for the image in our preloaded images and replace | |
// the path if we find it. | |
var preload = window.preload || {}; | |
_.each(images, function (val, key) { | |
if (_.has(preload, val)) { | |
images[key] = preload[val]; | |
} | |
}); | |
return images; | |
}, | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment