fix: remove bad URL constructor
This commit is contained in:
@ -11,17 +11,16 @@ export class WorkerRelayInterface {
|
||||
|
||||
/**
|
||||
* Interface wrapper for worker relay
|
||||
* @param path Path to worker script or Worker script object
|
||||
* @param scriptPath Path to worker script or Worker script object
|
||||
* @param sqlite3Dir Directory to search for sqlite3 depends
|
||||
*/
|
||||
constructor(path?: string | Worker, sqlite3Dir?: string) {
|
||||
if (path instanceof Worker) {
|
||||
this.#worker = path;
|
||||
constructor(scriptPath?: string | URL | Worker, sqlite3Dir?: string) {
|
||||
this.#sqliteDir = sqlite3Dir;
|
||||
if (scriptPath instanceof Worker) {
|
||||
this.#worker = scriptPath;
|
||||
} else {
|
||||
const sqliteBase = new URL("@sqlite.org/sqlite-wasm?url", import.meta.url);
|
||||
this.#sqliteDir = sqlite3Dir ?? sqliteBase.href;
|
||||
const scriptPath = path ? new URL(path) : new URL("@snort/worker-relay/dist/esm/worker.mjs", import.meta.url);
|
||||
this.#worker = new Worker(scriptPath, { type: "module" })
|
||||
const sp = scriptPath ? scriptPath : new URL("@snort/worker-relay/dist/esm/worker.mjs", import.meta.url);
|
||||
this.#worker = new Worker(sp, { type: "module" })
|
||||
};
|
||||
this.#worker.onerror = e => {
|
||||
console.error(e.message, e);
|
||||
|
Reference in New Issue
Block a user