🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

alice-bob

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alice-bob - npm Package Compare versions

Comparing version

to
1.1.0

6

dist/cjs/index.d.ts

@@ -39,2 +39,8 @@ /**

/**
* Returns the send method. Used in contexts where it might
* change between sessions, like browser refresh/hot/livereload.
* @override
*/
deferredSend: () => PayloadMethod;
/**
* Called by the user with the payload when it is received from their transport.

@@ -41,0 +47,0 @@ * @private

11

dist/cjs/index.js

@@ -91,2 +91,3 @@ "use strict";

else {
// eslint-disable-next-line
;

@@ -100,4 +101,10 @@ this.local[method](...args);

send: send ??
(() => {
throw new TypeError(`${this.local.name}.send(payload) method must be provided.`);
(data => {
if (this.local.deferredSend) {
this.local.send = this.local.deferredSend();
this.local.send(data);
}
else {
throw new TypeError(`${this.local.name}.send(payload) method must be provided.`);
}
}),

@@ -104,0 +111,0 @@ receive: this.receive,

@@ -39,2 +39,8 @@ /**

/**
* Returns the send method. Used in contexts where it might
* change between sessions, like browser refresh/hot/livereload.
* @override
*/
deferredSend: () => PayloadMethod;
/**
* Called by the user with the payload when it is received from their transport.

@@ -41,0 +47,0 @@ * @private

@@ -88,2 +88,3 @@ import { pop } from './util';

else {
// eslint-disable-next-line
;

@@ -97,4 +98,10 @@ this.local[method](...args);

send: send ??
(() => {
throw new TypeError(`${this.local.name}.send(payload) method must be provided.`);
(data => {
if (this.local.deferredSend) {
this.local.send = this.local.deferredSend();
this.local.send(data);
}
else {
throw new TypeError(`${this.local.name}.send(payload) method must be provided.`);
}
}),

@@ -101,0 +108,0 @@ receive: this.receive,

2

package.json

@@ -6,3 +6,3 @@ {

"description": "transport agnostic strongly typed duplex rpc interfaces",
"version": "1.0.0",
"version": "1.1.0",
"license": "MIT",

@@ -9,0 +9,0 @@ "repository": {

@@ -131,2 +131,3 @@ <h1 align="center">👫<br>alice-bob</h1>

* [send](#send)
* [deferredSend](#deferredsend)
* [log](#log)

@@ -146,3 +147,3 @@ * [AliceBob](#alicebob)

[src/index.ts:6-19](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L6-L19 "Source code on GitHub")
[src/index.ts:6-19](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L6-L19 "Source code on GitHub")

@@ -153,3 +154,3 @@ Payload.

[src/index.ts:10-10](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L10-L10 "Source code on GitHub")
[src/index.ts:10-10](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L10-L10 "Source code on GitHub")

@@ -162,3 +163,3 @@ Payload id.

[src/index.ts:14-14](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L14-L14 "Source code on GitHub")
[src/index.ts:14-14](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L14-L14 "Source code on GitHub")

@@ -171,3 +172,3 @@ Method to call.

[src/index.ts:18-18](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L18-L18 "Source code on GitHub")
[src/index.ts:18-18](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L18-L18 "Source code on GitHub")

@@ -180,3 +181,3 @@ The arguments passed to the method.

[src/index.ts:26-62](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L23-L25 "Source code on GitHub")
[src/index.ts:26-68](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L23-L25 "Source code on GitHub")

@@ -189,3 +190,3 @@ Agent.

[src/index.ts:30-30](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L30-L30 "Source code on GitHub")
[src/index.ts:30-30](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L30-L30 "Source code on GitHub")

@@ -198,3 +199,3 @@ Whether or not to log debugging information.

[src/index.ts:36-36](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L36-L36 "Source code on GitHub")
[src/index.ts:36-36](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L36-L36 "Source code on GitHub")

@@ -208,3 +209,3 @@ The name of the agent. Defaults to either 'alice' or 'bob' depending

[src/index.ts:41-41](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L41-L41 "Source code on GitHub")
[src/index.ts:41-41](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L41-L41 "Source code on GitHub")

@@ -215,5 +216,14 @@ The send method overriden by the user to any transport.

#### deferredSend
[src/index.ts:47-47](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L47-L47 "Source code on GitHub")
Returns the send method. Used in contexts where it might
change between sessions, like browser refresh/hot/livereload.
Type: function (): PayloadMethod
#### log
[src/index.ts:51-51](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L51-L51 "Source code on GitHub")
[src/index.ts:57-57](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L57-L57 "Source code on GitHub")

@@ -226,3 +236,3 @@ Overridable logging function. Defaults to `console.log()` and prepends `agent.name`.

[src/index.ts:76-257](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L76-L257 "Source code on GitHub")
[src/index.ts:82-269](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L82-L269 "Source code on GitHub")

@@ -237,3 +247,3 @@ AliceBob class.

[src/index.ts:89-89](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L89-L89 "Source code on GitHub")
[src/index.ts:95-95](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L95-L95 "Source code on GitHub")

@@ -246,3 +256,3 @@ The local Agent.

[src/index.ts:93-93](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L93-L93 "Source code on GitHub")
[src/index.ts:99-99](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L99-L99 "Source code on GitHub")

@@ -255,3 +265,3 @@ The remote Agent.

[src/index.ts:253-256](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L253-L256 "Source code on GitHub")
[src/index.ts:265-268](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L265-L268 "Source code on GitHub")

@@ -274,3 +284,3 @@ Returns the agents tuple `[alice, bob]`.

[src/index.ts:265-275](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L265-L275 "Source code on GitHub")
[src/index.ts:277-287](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L277-L287 "Source code on GitHub")

@@ -287,3 +297,3 @@ **Extends AliceBob**

[src/index.ts:283-293](https://github.com/stagas/alice-bob/blob/94f301ce88021c17fa2ec41366af8e00fa045da4/src/index.ts#L283-L293 "Source code on GitHub")
[src/index.ts:295-305](https://github.com/stagas/alice-bob/blob/d6320360075e76278be7cfe3f96d9b9aa562a6cb/src/index.ts#L295-L305 "Source code on GitHub")

@@ -290,0 +300,0 @@ **Extends AliceBob**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet