mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-24 03:57:08 -04:00
Begin to move all src javascript to es6. Add search/filter ignore case option.
This commit is contained in:
parent
f37e8e7b89
commit
7ec2bdf16a
58 changed files with 3546 additions and 3420 deletions
23
src/_h5ai/public/js/lib/win.js
Normal file
23
src/_h5ai/public/js/lib/win.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const win = window; // eslint-disable-line no-undef
|
||||
|
||||
if (typeof win !== 'object' || win.window !== win || !win.document) {
|
||||
throw new Error('no-window');
|
||||
}
|
||||
|
||||
const noBrowser = 'no-browser';
|
||||
const doc = win.document;
|
||||
const docEl = doc.documentElement;
|
||||
docEl.className = '';
|
||||
|
||||
function assert(expr, hint) {
|
||||
if (!expr) {
|
||||
docEl.className = noBrowser;
|
||||
throw new Error(`${noBrowser}: ${hint}`);
|
||||
}
|
||||
}
|
||||
|
||||
assert(!doc.getElementById(noBrowser), 'ie<10');
|
||||
assert(typeof Object.assign === 'function', 'assign');
|
||||
assert(typeof Promise === 'function', 'promise');
|
||||
|
||||
module.exports = win;
|
Loading…
Add table
Add a link
Reference in a new issue