52 lines
1.0 KiB
HTML
52 lines
1.0 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<script src="./main.js"></script>
|
|
<script type="ignore-me">
|
|
|
|
// import IndexFile from "../../src/browser/indexFile.js";
|
|
console.log(333, IndexFile)
|
|
|
|
let posExt = ['adj', 'adv', 'noun', 'verb'];
|
|
let dictRoot = '../../dict/';
|
|
let files = {};
|
|
|
|
function loadPos(pos) {
|
|
|
|
return import(dictRoot + 'index.' + pos + '.js');
|
|
|
|
console.time('load-' + pos);
|
|
let get = (name) => {
|
|
let path = dictRoot + name + '.' + pos + '.json';
|
|
|
|
return fetch(path).then(res => res.json()).then(obj => {
|
|
// console.log(`got ${path}: `, text);
|
|
files[pos] = files[pos] || {};
|
|
files[pos][name] = obj;
|
|
console.timeEnd('load-' + pos);
|
|
});
|
|
|
|
};
|
|
|
|
// get('data');
|
|
return get('index');
|
|
}
|
|
|
|
|
|
let pos = 'adv';
|
|
loadPos(pos).then(result => {
|
|
console.log('got', pos ,result);
|
|
window.res = result.default;
|
|
});
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Self-hosted WordPOS sample</h1>
|
|
<script>
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|