dho-rpc-transport-webworker
Version:
Easy way to communicate with webworker using dho-rpc (JSON RPC library)
18 lines (13 loc) • 459 B
JavaScript
import 'babel-polyfill';
import MoleClient from 'dho-rpc/MoleClientProxified';
import TransportClient from '../../TransportClient';
async function main() {
const worker = new Worker('worker.js');
const client = new MoleClient({
requestTimeout: 1000,
transport: new TransportClient({ worker })
});
console.log(await client.sum(2, 3));
console.log(await client.multiply(2, 3));
}
main().then(console.log, console.error);