mirror of
https://github.com/ChiChou/entdb.git
synced 2026-06-10 23:07:47 +02:00
disable WASM SQLite engine, use KV backend only
This commit is contained in:
+1
-21
@@ -1,28 +1,8 @@
|
||||
import type { Engine } from "./types";
|
||||
import { WASMEngine } from "./wasm";
|
||||
import { checkWASMSupport as checkSQLiteWASMSupport } from "./wasm";
|
||||
import { KVEngine } from "./kv";
|
||||
|
||||
let wasmSupported: boolean | null = null;
|
||||
const wasmDisabled = process.env.NEXT_PUBLIC_USE_WASM === "0";
|
||||
|
||||
async function checkWASMSupport(): Promise<boolean> {
|
||||
if (wasmSupported !== null) return wasmSupported;
|
||||
|
||||
wasmSupported = await checkSQLiteWASMSupport();
|
||||
return wasmSupported;
|
||||
}
|
||||
|
||||
export async function createEngine(group: string): Promise<Engine> {
|
||||
if (wasmDisabled) {
|
||||
return new KVEngine(group);
|
||||
}
|
||||
|
||||
const supported = await checkWASMSupport();
|
||||
if (supported) {
|
||||
return new WASMEngine();
|
||||
}
|
||||
return new KVEngine(group);
|
||||
}
|
||||
|
||||
export { KVEngine, WASMEngine };
|
||||
export { KVEngine };
|
||||
|
||||
Reference in New Issue
Block a user