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

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

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 };
});