WIP: use es-modules
This commit is contained in:
parent
ec5b050496
commit
9c3450947b
146 changed files with 722 additions and 62 deletions
|
|
@ -2,15 +2,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
/*@
|
||||
Ox <f> The `Ox` object
|
||||
See `Ox.wrap` for details.
|
||||
(value) -> <o> wrapped value
|
||||
value <*> Any value
|
||||
@*/
|
||||
this.Ox = function(value) {
|
||||
return Ox.wrap(value);
|
||||
};
|
||||
import Ox from './Namespace.js';
|
||||
|
||||
/*@
|
||||
Ox.load <f> Loads OxJS and, optionally, one or more modules
|
||||
|
|
@ -76,21 +68,28 @@ Ox.load = function() {
|
|||
if (!length) {
|
||||
callback(true);
|
||||
} else {
|
||||
Ox.forEach(modules, function(options, module) {
|
||||
Ox.getFile(
|
||||
Ox.PATH + module + '/' + module + '.js?' + Ox.VERSION,
|
||||
function() {
|
||||
Ox.load[module](options, function(success) {
|
||||
succeeded += success;
|
||||
if (++loaded == length) {
|
||||
Ox.setLocale(Ox.LOCALE, function() {
|
||||
callback(succeeded == length);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
let fn = Ox.noop
|
||||
console.log("!!", modules)
|
||||
if ('UI' in modules) {
|
||||
fn = function(callback) {
|
||||
var path = Ox.PATH + 'UI/jquery/jquery-1.7.1.min.js?' + Ox.VERSION;
|
||||
Ox.getFile(path, callback)
|
||||
}
|
||||
}
|
||||
fn(function() {
|
||||
Ox.forEach(modules, async function(options, module) {
|
||||
console.log("load module!", module, options)
|
||||
const obj = await import('../../' + module + '/index.js?' + Ox.VERSION);
|
||||
Ox.load[module](options, function(success) {
|
||||
succeeded += success;
|
||||
if (++loaded == length) {
|
||||
Ox.setLocale(Ox.LOCALE, function() {
|
||||
callback(succeeded == length);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -114,7 +113,7 @@ Ox.localStorage = function(namespace) {
|
|||
var localStorage;
|
||||
try {
|
||||
// this will fail if third party cookies/storage is not allowed
|
||||
localStorage = window.localStorage || {};
|
||||
localStorage = globalThis.localStorage || {};
|
||||
// FF 3.6 can't assign to or iterate over localStorage
|
||||
for (var key in localStorage) {}
|
||||
// In Safari (OS X or iOS) is in private browsing mode,
|
||||
|
|
@ -206,7 +205,7 @@ Ox.Log = (function() {
|
|||
args.unshift(
|
||||
Ox.formatDate(date, '%H:%M:%S.') + (+date).toString().slice(-3)
|
||||
);
|
||||
window.console && window.console.log && window.console.log.apply(window.console, args);
|
||||
globalThis.console && globalThis.console.log && globalThis.console.log.apply(globalThis.console, args);
|
||||
ret = args.join(' ');
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -268,7 +267,7 @@ Ox.print = function() {
|
|||
args.unshift(
|
||||
date.toString().split(' ')[4] + '.' + (+date).toString().slice(-3)
|
||||
);
|
||||
window.console && window.console.log.apply(window.console, args);
|
||||
globalThis.console && globalThis.console.log.apply(globalThis.console, args);
|
||||
return args.join(' ');
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue