1 import * as PassRustCore from '@protontech/pass-rust-core';
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((PassRustCore[method] as any)(...args));