alice-bob
transport agnostic strongly typed duplex rpc interfaces
npm i alice-bob
|
pnpm add alice-bob
|
yarn add alice-bob
|
API
{ string PayloadMethod<Agent<B, A>> deferredSend() => #
src/alice-bob.ts#L292 Alice
– Alice class.
#
src/alice-bob.ts#L95 local
– The local Agent.
#
src/alice-bob.ts#L38 name
– The name of the agent. Defaults to either 'alice' or 'bob' depending
on the constructor used, Alice or Bob.
#
src/alice-bob.ts#L43 send
– The send method overriden by the user to any transport.
#
src/alice-bob.ts#L49 deferredSend
() – Returns the send method. Used in contexts where it might
change between sessions, like browser refresh/hot/livereload.
PayloadMethod<Agent<B, A>>
# log
(args) – Overridable logging function. Defaults to console.log()
and prepends agent.name
.
src/alice-bob.ts#L63 unknown []#
args
log(args) =>
- void
}
# agents
(local, remote) – Returns the agents tuple [alice, bob]
.
src/alice-bob.ts#L276
Example:
const [alice, bob] = new Alice<Local, Remote>().agents()
// to enable debugging on local (alice)
const [alice, bob] = new Alice<Local, Remote>().agents({ debug: true })
// use different names:
const [alice, bob] = new Alice<Local, Remote>().agents(
{ name: 'server', debug: true },
{ name: 'client' }
)
agents(local, remote) =>
- [ {
string PayloadMethod<Agent<B, A>> deferredSend() => #
src/alice-bob.ts#L38 name
– The name of the agent. Defaults to either 'alice' or 'bob' depending
on the constructor used, Alice or Bob.
#
src/alice-bob.ts#L43 send
– The send method overriden by the user to any transport.
#
src/alice-bob.ts#L49 deferredSend
() – Returns the send method. Used in contexts where it might
change between sessions, like browser refresh/hot/livereload.
PayloadMethod<Agent<B, A>>
# log
(args) – Overridable logging function. Defaults to console.log()
and prepends agent.name
.
src/alice-bob.ts#L63 unknown []#
args
log(args) =>
- void
}, Agent<B, A> ]
# AliceBob
– AliceBob class.
src/alice-bob.ts#L82 { string PayloadMethod<Agent<B, A>> deferredSend() => #
src/alice-bob.ts#L95 local
– The local Agent.
#
src/alice-bob.ts#L38 name
– The name of the agent. Defaults to either 'alice' or 'bob' depending
on the constructor used, Alice or Bob.
#
src/alice-bob.ts#L43 send
– The send method overriden by the user to any transport.
#
src/alice-bob.ts#L49 deferredSend
() – Returns the send method. Used in contexts where it might
change between sessions, like browser refresh/hot/livereload.
PayloadMethod<Agent<B, A>>
# log
(args) – Overridable logging function. Defaults to console.log()
and prepends agent.name
.
src/alice-bob.ts#L63 unknown []#
args
log(args) =>
- void
}
# agents
(local, remote) – Returns the agents tuple [alice, bob]
.
src/alice-bob.ts#L276
Example:
const [alice, bob] = new Alice<Local, Remote>().agents()
// to enable debugging on local (alice)
const [alice, bob] = new Alice<Local, Remote>().agents({ debug: true })
// use different names:
const [alice, bob] = new Alice<Local, Remote>().agents(
{ name: 'server', debug: true },
{ name: 'client' }
)
agents(local, remote) =>
- [ {
string PayloadMethod<Agent<B, A>> deferredSend() => #
src/alice-bob.ts#L38 name
– The name of the agent. Defaults to either 'alice' or 'bob' depending
on the constructor used, Alice or Bob.
#
src/alice-bob.ts#L43 send
– The send method overriden by the user to any transport.
#
src/alice-bob.ts#L49 deferredSend
() – Returns the send method. Used in contexts where it might
change between sessions, like browser refresh/hot/livereload.
PayloadMethod<Agent<B, A>>
# log
(args) – Overridable logging function. Defaults to console.log()
and prepends agent.name
.
src/alice-bob.ts#L63 unknown []#
args
log(args) =>
- void
}, Agent<B, A> ]
# Bob
– Bob class.
src/alice-bob.ts#L313 { string PayloadMethod<Agent<B, A>> deferredSend() => #
src/alice-bob.ts#L95 local
– The local Agent.
#
src/alice-bob.ts#L38 name
– The name of the agent. Defaults to either 'alice' or 'bob' depending
on the constructor used, Alice or Bob.
#
src/alice-bob.ts#L43 send
– The send method overriden by the user to any transport.
#
src/alice-bob.ts#L49 deferredSend
() – Returns the send method. Used in contexts where it might
change between sessions, like browser refresh/hot/livereload.
PayloadMethod<Agent<B, A>>
# log
(args) – Overridable logging function. Defaults to console.log()
and prepends agent.name
.
src/alice-bob.ts#L63 unknown []#
args
log(args) =>
- void
}
# agents
(local, remote) – Returns the agents tuple [alice, bob]
.
src/alice-bob.ts#L276
Example:
const [alice, bob] = new Alice<Local, Remote>().agents()
// to enable debugging on local (alice)
const [alice, bob] = new Alice<Local, Remote>().agents({ debug: true })
// use different names:
const [alice, bob] = new Alice<Local, Remote>().agents(
{ name: 'server', debug: true },
{ name: 'client' }
)
agents(local, remote) =>
- [ {
string PayloadMethod<Agent<B, A>> deferredSend() => #
src/alice-bob.ts#L38 name
– The name of the agent. Defaults to either 'alice' or 'bob' depending
on the constructor used, Alice or Bob.
#
src/alice-bob.ts#L43 send
– The send method overriden by the user to any transport.
#
src/alice-bob.ts#L49 deferredSend
() – Returns the send method. Used in contexts where it might
change between sessions, like browser refresh/hot/livereload.
PayloadMethod<Agent<B, A>>
# log
(args) – Overridable logging function. Defaults to console.log()
and prepends agent.name
.
src/alice-bob.ts#L63 unknown []#
args
log(args) =>
- void
}, Agent<B, A> ]
# Agent
– Agent.
src/alice-bob.ts#L28 {
string PayloadMethod<Agent<B, A>> deferredSend() => #
src/alice-bob.ts#L38 name
– The name of the agent. Defaults to either 'alice' or 'bob' depending
on the constructor used, Alice or Bob.
#
src/alice-bob.ts#L43 send
– The send method overriden by the user to any transport.
#
src/alice-bob.ts#L49 deferredSend
() – Returns the send method. Used in contexts where it might
change between sessions, like browser refresh/hot/livereload.
PayloadMethod<Agent<B, A>>
# log
(args) – Overridable logging function. Defaults to console.log()
and prepends agent.name
.
src/alice-bob.ts#L63 unknown []#
args
log(args) =>
- void
Contributing
All contributions are welcome!