Socket
Socket
Sign inDemoInstall

birpc

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

birpc - npm Package Compare versions

Comparing version 0.2.17 to 0.2.18

9

dist/index.d.ts

@@ -15,2 +15,6 @@ type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never;

/**
* Clear the listener when `$close` is called
*/
off?: (fn: (data: any, ...extras: any[]) => void) => any | Promise<any>;
/**
* Custom function to serialize data

@@ -27,2 +31,6 @@ *

deserialize?: (data: any) => any;
/**
* Call the methods with the RPC context or the original functions object
*/
bind?: 'rpc' | 'functions';
}

@@ -76,2 +84,3 @@ interface EventOptions<Remote> {

$functions: LocalFunctions;
$close: () => void;
};

@@ -78,0 +87,0 @@ type BirpcGroupReturn<RemoteFunctions> = {

21

package.json
{
"name": "birpc",
"type": "module",
"version": "0.2.17",
"packageManager": "pnpm@8.15.3",
"version": "0.2.18",
"description": "Message based Two-way remote procedure call",

@@ -37,12 +36,12 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>",

"devDependencies": {
"@antfu/eslint-config": "^2.6.4",
"@antfu/ni": "^0.21.12",
"@types/node": "^20.11.19",
"bumpp": "^9.3.0",
"eslint": "^8.56.0",
"esno": "^4.0.0",
"typescript": "^5.3.3",
"@antfu/eslint-config": "^3.7.3",
"@antfu/ni": "^0.23.0",
"@types/node": "^22.7.5",
"bumpp": "^9.6.1",
"eslint": "^9.12.0",
"esno": "^4.8.0",
"typescript": "^5.6.2",
"unbuild": "^2.0.0",
"vite": "^5.1.3",
"vitest": "^1.3.0"
"vite": "^5.4.8",
"vitest": "^2.1.2"
},

@@ -49,0 +48,0 @@ "scripts": {

@@ -50,4 +50,4 @@ # birpc

```ts
import type { ClientFunctions } from './types'
import { WebSocketServer } from 'ws'
import type { ClientFunctions } from './types'

@@ -67,3 +67,3 @@ const serverFunctions: ServerFunctions = {

post: data => ws.send(data),
on: data => ws.on('message', data),
on: fn => ws.on('message', fn),
serialize: v => JSON.stringify(v),

@@ -89,3 +89,3 @@ deserialize: v => JSON.parse(v),

post: data => ws.send(data),
on: data => ws.on('message', data),
on: fn => ws.on('message', fn),
// use flatted as serializer

@@ -122,3 +122,3 @@ serialize: v => stringify(v),

post: data => channel.port1.postMessage(data),
on: data => channel.port1.on('message', data),
on: fn => channel.port1.on('message', fn),
},

@@ -146,3 +146,3 @@ )

post: data => channel.port2.postMessage(data),
on: data => channel.port2.on('message', data),
on: fn => channel.port2.on('message', fn),
},

@@ -149,0 +149,0 @@ )

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc