in ox dev loader, allow for switching to build version by passing true as first argument (can be used to avoid boilerplate when choosing build/ or dev/ dynamically)

This commit is contained in:
rolux 2012-06-26 19:17:27 +02:00
parent 2efbc53b33
commit 80e0a02ea3

View file

@ -11,18 +11,26 @@
path = getPath(),
time = +new Date();
loadJSON(function(data) {
var previousOx = global.Ox;
loadScriptsSerial(data.files, function() {
Ox.VERSION = data.version;
Ox.forEach(previousOx, function(value, key) {
if (Ox.isUndefined(Ox[key])) {
Ox[key] = value;
}
});
Ox.load.apply(null, args);
if (args[0] === true) {
console.log('OK')
path = path.replace(/dev\/$/, 'build/');
loadScript('Ox.js', function() {
Ox.load.apply(null, Ox.slice(args, 1));
});
});
} else {
loadJSON(function(data) {
var previousOx = global.Ox;
loadScriptsSerial(data.files, function() {
Ox.VERSION = data.version;
Ox.forEach(previousOx, function(value, key) {
if (Ox.isUndefined(Ox[key])) {
Ox[key] = value;
}
});
Ox.load.apply(null, args);
});
});
}
function getPath() {
var i, path, scripts = document.getElementsByTagName('script');