1 import * as PassRustWorker from '@protontech/pass-rust-core/worker';
3 import type { PassCoreMethod, PassCoreRPC } from './types';
5 /** Handles incoming PassCoreRPC messages to execute functions
6 * from the PassRustCore WebAssembly module */
7 self.onmessage = ({ data: { method, args }, ports }: MessageEvent<PassCoreRPC<PassCoreMethod>>) => {
8 const port = ports?.[0];
9 if (port) port.postMessage((PassRustWorker[method] as any)(...args));