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:
parent
2efbc53b33
commit
80e0a02ea3
1 changed files with 19 additions and 11 deletions
30
source/Ox.js
30
source/Ox.js
|
@ -11,18 +11,26 @@
|
||||||
path = getPath(),
|
path = getPath(),
|
||||||
time = +new Date();
|
time = +new Date();
|
||||||
|
|
||||||
loadJSON(function(data) {
|
if (args[0] === true) {
|
||||||
var previousOx = global.Ox;
|
console.log('OK')
|
||||||
loadScriptsSerial(data.files, function() {
|
path = path.replace(/dev\/$/, 'build/');
|
||||||
Ox.VERSION = data.version;
|
loadScript('Ox.js', function() {
|
||||||
Ox.forEach(previousOx, function(value, key) {
|
Ox.load.apply(null, Ox.slice(args, 1));
|
||||||
if (Ox.isUndefined(Ox[key])) {
|
|
||||||
Ox[key] = value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Ox.load.apply(null, args);
|
|
||||||
});
|
});
|
||||||
});
|
} 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() {
|
function getPath() {
|
||||||
var i, path, scripts = document.getElementsByTagName('script');
|
var i, path, scripts = document.getElementsByTagName('script');
|
||||||
|
|
Loading…
Reference in a new issue