Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new interface for messageChannel and deprecates old, close #19
- Loading branch information
1 parent
d241b34
commit 7022b8c
Showing
33 changed files
with
438 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [async-call-rpc](./async-call-rpc.md) > [CallbackBasedChannel](./async-call-rpc.callbackbasedchannel.md) | ||
|
||
## CallbackBasedChannel interface | ||
|
||
This interface represents a "callback" model. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface CallbackBasedChannel<Data = unknown> extends Partial<EventBasedChannel<Data>> | ||
``` | ||
<b>Extends:</b> Partial<[EventBasedChannel](./async-call-rpc.eventbasedchannel.md)<!-- --><Data>> | ||
## Remarks | ||
Usually used for there are many remotes (act like a server). | ||
## Methods | ||
| Method | Description | | ||
| --- | --- | | ||
| [setup(jsonRPCHandlerCallback, isValidJSONRPCPayload)](./async-call-rpc.callbackbasedchannel.setup.md) | Setup the CallbackBasedChannel.. | | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [async-call-rpc](./async-call-rpc.md) > [CallbackBasedChannel](./async-call-rpc.callbackbasedchannel.md) > [setup](./async-call-rpc.callbackbasedchannel.setup.md) | ||
|
||
## CallbackBasedChannel.setup() method | ||
|
||
Setup the CallbackBasedChannel.. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
setup(jsonRPCHandlerCallback: (jsonRPCPayload: unknown) => Promise<unknown | undefined>, isValidJSONRPCPayload: (data: unknown) => boolean | Promise<boolean>): (() => void) | void; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| jsonRPCHandlerCallback | (jsonRPCPayload: unknown) => Promise<unknown \| undefined> | A function that will execute the JSON RPC request then give the result back. If the result is undefined, it means no response is created. | | ||
| isValidJSONRPCPayload | (data: unknown) => boolean \| Promise<boolean> | | | ||
|
||
<b>Returns:</b> | ||
|
||
(() => void) \| void | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [async-call-rpc](./async-call-rpc.md) > [Console](./async-call-rpc.console.md) > [warn](./async-call-rpc.console.warn.md) | ||
|
||
## Console.warn() method | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
warn?(...args: unknown[]): void; | ||
``` | ||
## Parameters | ||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| args | unknown\[\] | | | ||
<b>Returns:</b> | ||
void | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [async-call-rpc](./async-call-rpc.md) > [EventBasedChannel](./async-call-rpc.eventbasedchannel.md) | ||
|
||
## EventBasedChannel interface | ||
|
||
This interface represents a "on message"-"send response" model. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface EventBasedChannel<Data = unknown> | ||
``` | ||
|
||
## Remarks | ||
|
||
Usually used for there is only 1 remote (act like a client). | ||
|
||
## Methods | ||
|
||
| Method | Description | | ||
| --- | --- | | ||
| [on(listener)](./async-call-rpc.eventbasedchannel.on.md) | Register the message listener. | | ||
| [send(data)](./async-call-rpc.eventbasedchannel.send.md) | Send the data to the remote side. | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [async-call-rpc](./async-call-rpc.md) > [EventBasedChannel](./async-call-rpc.eventbasedchannel.md) > [on](./async-call-rpc.eventbasedchannel.on.md) | ||
|
||
## EventBasedChannel.on() method | ||
|
||
Register the message listener. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
on(listener: (data: Data) => void): void | (() => void); | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| listener | (data: Data) => void | The message listener. | | ||
|
||
<b>Returns:</b> | ||
|
||
void \| (() => void) | ||
|
||
a function that unregister the listener. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [async-call-rpc](./async-call-rpc.md) > [EventBasedChannel](./async-call-rpc.eventbasedchannel.md) > [send](./async-call-rpc.eventbasedchannel.send.md) | ||
|
||
## EventBasedChannel.send() method | ||
|
||
Send the data to the remote side. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
send(data: Data): void; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| data | Data | The data should send to the remote side. | | ||
|
||
<b>Returns:</b> | ||
|
||
void | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.