wpc
Simple RPC solution for Workers, SharedWorkers and ServiceWorkers.
Install
$ npm install @geut/wpc
Usage
import { WPC } from '@geut/wpc'
// main-thread.js
const rpc = new WPC(/** @type {Worker|MessagePort} */)
rpc.actions({
ping: () => 'pong'
})
// worker-thread.js
const rpc = new WPC(self)
await rpc.call('ping') // returns pong
Issues
Contributing
License
MIT © A GEUT project