Simple RPC solution for Workers, SharedWorkers and ServiceWorkers.
$ npm install @geut/wpc
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
🐛 If you found an issue we encourage you to report it on github. Please specify your OS and the actions to reproduce it.
👥 Ideas and contributions to the project are welcome. You must follow this guideline.
MIT © A GEUT project