102 lines
2.6 KiB
JavaScript
102 lines
2.6 KiB
JavaScript
|
|
'use strict';
|
||
|
|
|
||
|
|
/*@
|
||
|
|
Ox <f> The `Ox` object
|
||
|
|
See `Ox.wrap` for details.
|
||
|
|
(value) -> <o> wrapped value
|
||
|
|
value <*> Any value
|
||
|
|
@*/
|
||
|
|
|
||
|
|
import * as OxCore from './js/Core.js';
|
||
|
|
import * as OxFunction from './js/Function.js';
|
||
|
|
import * as OxPolyfill from './js/Polyfill.js';
|
||
|
|
import * as OxArray from './js/Array.js';
|
||
|
|
import * as OxString from './js/String.js';
|
||
|
|
import * as OxCollection from './js/Collection.js';
|
||
|
|
import * as OxMath from './js/Math.js';
|
||
|
|
|
||
|
|
|
||
|
|
import * as OxAsync from './js/Async.js';
|
||
|
|
import * as OxColor from './js/Color.js';
|
||
|
|
import * as OxConstants from './js/Constants.js';
|
||
|
|
import * as OxDate from './js/Date.js';
|
||
|
|
import * as OxDOM from './js/DOM.js';
|
||
|
|
import * as OxEncoding from './js/Encoding.js';
|
||
|
|
import * as OxFormat from './js/Format.js';
|
||
|
|
import * as OxGeo from './js/Geo.js';
|
||
|
|
import * as OxHash from './js/Hash.js';
|
||
|
|
import * as OxHTML from './js/HTML.js';
|
||
|
|
import * as OxJavaScript from './js/JavaScript.js';
|
||
|
|
import * as OxLocale from './js/Locale.js';
|
||
|
|
import * as OxObject from './js/Object.js';
|
||
|
|
import * as OxRegExp from './js/RegExp.js';
|
||
|
|
import * as OxRequest from './js/Request.js';
|
||
|
|
import * as OxType from './js/Type.js';
|
||
|
|
import * as OxVideo from './js/Video.js';
|
||
|
|
|
||
|
|
|
||
|
|
const Ox = function(value) {
|
||
|
|
return OxCore.wrap(value)
|
||
|
|
};
|
||
|
|
|
||
|
|
Object.assign(Ox,
|
||
|
|
OxCore,
|
||
|
|
OxFunction,
|
||
|
|
OxPolyfill,
|
||
|
|
OxArray,
|
||
|
|
OxString,
|
||
|
|
OxCollection,
|
||
|
|
OxMath,
|
||
|
|
OxAsync,
|
||
|
|
OxColor,
|
||
|
|
OxConstants,
|
||
|
|
OxDate,
|
||
|
|
OxDOM,
|
||
|
|
OxEncoding,
|
||
|
|
OxFormat,
|
||
|
|
OxGeo,
|
||
|
|
OxHash,
|
||
|
|
OxHTML,
|
||
|
|
OxJavaScript,
|
||
|
|
OxLocale,
|
||
|
|
OxObject,
|
||
|
|
OxRegExp,
|
||
|
|
OxRequest,
|
||
|
|
OxType,
|
||
|
|
OxVideo,
|
||
|
|
);
|
||
|
|
|
||
|
|
export default Ox;
|
||
|
|
export { Ox };
|
||
|
|
|
||
|
|
// For backward compatibility with global usage
|
||
|
|
if (typeof window !== 'undefined') {
|
||
|
|
window.Ox = Ox;
|
||
|
|
Ox.loadPolyfill(window, Ox)
|
||
|
|
|
||
|
|
/*@
|
||
|
|
Ox.documentReady <function> Calls a callback function once the DOM is ready
|
||
|
|
(callback) -> <b> If true, the document was ready
|
||
|
|
callback <f> Callback function
|
||
|
|
@*/
|
||
|
|
Ox.documentReady = (function() {
|
||
|
|
var callbacks = [];
|
||
|
|
document.onreadystatechange = window.onload = function() {
|
||
|
|
if (document.readyState == 'complete') {
|
||
|
|
callbacks.forEach(function(callback) {
|
||
|
|
callback();
|
||
|
|
});
|
||
|
|
document.onreadystatechange = window.onload = null;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
return function(callback) {
|
||
|
|
if (document.readyState == 'complete') {
|
||
|
|
callback();
|
||
|
|
return true;
|
||
|
|
} else {
|
||
|
|
callbacks.push(callback);
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}());
|
||
|
|
}
|