A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
refactor: use comlink instead of threads
thecodrr711f870718d8
diff --git a/apps/web/packages/nncryptoworker/index.ts b/apps/web/packages/nncryptoworker/index.tsindex 43b564859..ddf29ea7c 100644--- a/apps/web/packages/nncryptoworker/index.ts+++ b/apps/web/packages/nncryptoworker/index.ts@@ -6,9 +6,9 @@ import {EncryptionKey,} from "nncrypto/dist/src/types";import { Chunk } from "streamablefs/dist/src/types";-import { spawn, Worker } from "threads";import { NNCryptoWorkerModule } from "./src/worker";import { INNCrypto, IStreamable } from "nncrypto/dist/src/interfaces";+import { wrap } from "comlink";export class NNCryptoWorker implements INNCrypto {private worker?: Worker;@@ -25,7 +25,8 @@ export class NNCryptoWorker implements INNCrypto {if (this.isReady) return;this.worker = new Worker(this.path);- this.workermodule = await spawn<NNCryptoWorkerModule>(this.worker);+ this.workermodule = wrap<NNCryptoWorkerModule>(this.worker);+ // this.workermodule = await spawn<NNCryptoWorkerModule>(this.worker);this.isReady = true;}diff --git a/apps/web/packages/nncryptoworker/package.json b/apps/web/packages/nncryptoworker/package.jsonindex dc0a0efe1..b77857bc0 100644--- a/apps/web/packages/nncryptoworker/package.json+++ b/apps/web/packages/nncryptoworker/package.json@@ -10,9 +10,9 @@"author": "","license": "ISC","dependencies": {+ "comlink": "^4.3.1","nncrypto": "file:../nncrypto",- "streamablefs": "file:../streamablefs",- "threads": "^1.7.0"+ "streamablefs": "file:../streamablefs"},"devDependencies": {"typescript": "^4.4.3"diff --git a/apps/web/packages/nncryptoworker/src/worker.ts b/apps/web/packages/nncryptoworker/src/worker.tsindex fe416c17b..bbb195de0 100644--- a/apps/web/packages/nncryptoworker/src/worker.ts+++ b/apps/web/packages/nncryptoworker/src/worker.ts@@ -1,6 +1,6 @@import { NNCrypto } from "nncrypto";import { SerializedKey } from "nncrypto/dist/src/types";-import { expose } from "threads/worker";+import { expose } from "comlink";import WorkerStream from "./workerstream";const crypto = new NNCrypto();