Skip to content
This repository has been archived by the owner on Mar 19, 2023. It is now read-only.

Commit

Permalink
Switch from wasm to pure js for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
skymkmk committed Nov 11, 2022
1 parent ab05d29 commit 0cb4091
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ehconverter",
"private": true,
"version": "0.1.0-alpha",
"version": "0.1.1-alpha",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -15,10 +15,10 @@
"sass": "^1.56.1",
"tailwindcss": "^3.2.2",
"typescript": "^4.6.4",
"vite": "^3.2.3"
"vite": "^3.2.3",
"vite-plugin-top-level-await": "^1.2.1"
},
"dependencies": {
"sql.js": "^1.8.0",
"vite-plugin-top-level-await": "^1.2.1"
"sql.js": "^1.8.0"
}
}
11 changes: 4 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import initSqlJs from 'sql.js'
import initSqlJs from 'sql.js/dist/sql-asm'
import { version } from "../package.json"
import sqlWasm from "sql.js/dist/sql-wasm.wasm?url"
const upload : HTMLDivElement = document.getElementById("upload") as HTMLDivElement;
const db : HTMLInputElement = document.getElementById("db") as HTMLInputElement;
const verDOM : HTMLSpanElement = document.getElementById("version") as HTMLSpanElement;
verDOM.innerHTML = `v${version}`;
const a = document.createElement('a');
const SQL = await initSqlJs({
locateFile: () => sqlWasm
});
const SQL = await initSqlJs();
upload.onclick = () => {
db.click();
}
Expand All @@ -32,9 +29,9 @@ db.onchange = e => {
if ((e as Error).message === "file is not a database") {
alert("你的文件并非数据库文件。请上传正确的文件!");
}
else alert(e);
}
}
reader.readAsArrayBuffer(file);
}
}
export {}
}
3 changes: 3 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ export default defineConfig({
plugins: [
topLevelAwait()
],
build: {
target: "es2015"
}
});

0 comments on commit 0cb4091

Please sign in to comment.