0.9.7 • Published 1 year ago

@mysnpm/m-rpc v0.9.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

m-rpc

jsr-version npm-version npm-downloads npm-minzip docs license coverage workflow-ci workflow-release

A message based RPC library.

Usage

basic

import { MRpc } from "@mysnpm/m-rpc";

function add(a: number, b: number) {
  return a + b;
}

// The port can be a MessagePort, a WebSocket, or an object
// containing methods for sending and receiving messages.
const { port1, port2 } = new MessageChannel();
const rpc1 = new MRpc(port1);
const rpc2 = new MRpc(port2);

rpc1.defineLocalFn("add", add);
await rpc2.callRemoteFn<typeof add>("add", [1, 2]); // 3

License

MIT License © 2024-PRESENT mys1024

0.9.7

1 year ago

0.9.6

1 year ago

0.9.5

1 year ago

0.9.4

1 year ago

0.9.3

1 year ago