feat: get web worker mechanism working (pass file around)

This commit is contained in:
鲁树人 committed 2023-05-08 17:36:10 +01:00
1 parent 29b169cce6
commit 911ee2a2fa
7 files changed
+150 -6

No files matched your search

+12 -3
View File
@@ -1,3 +1,12 @@
onmessage = (e) => {
console.log(e.data);
};
import { WorkerServerBus } from '../util/WorkerEventBus';
import { DECRYPTION_WORKER_ACTION_NAME } from './constants';
const bus = new WorkerServerBus();
onmessage = bus.onmessage;
bus.addEventHandler(DECRYPTION_WORKER_ACTION_NAME.DECRYPT, async (blobURI) => {
const blob = await fetch(blobURI).then((r) => r.arrayBuffer());
// TODO: Implement decryptor for blob received here.
console.log(blob);
return { hello: true };
});