https://github.com/hrsh7th/deno-json-rpc
Strongly typed json-rpc module for deno.
https://github.com/hrsh7th/deno-json-rpc
Last synced: 5 months ago
JSON representation
Strongly typed json-rpc module for deno.
- Host: GitHub
- URL: https://github.com/hrsh7th/deno-json-rpc
- Owner: hrsh7th
- Created: 2020-12-25T13:17:46.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-26T04:58:37.000Z (almost 5 years ago)
- Last Synced: 2024-05-01T20:20:31.345Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 9.77 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# typed-json-rpc
Strongly typed JSON-RPC module.
# Usage
```typescript
import { RPC, VSCodeIO } from 'https://deno.land/x/typed_json_rpc/mod.ts'type TextDocumentDefinitionRequest = {
method: 'textDocument/definition';
params: vscode.TextDocumentPositionParams;
result: vscode.Location | vscode.Location[];
};const rpc = new RPC<{
IncomingRequest: TextDocumentDefinitionRequest;
OutgoingRequest: never;
IncomingNotification: never;
OutgoingNotification: never;
}>({
io: new VSCodeIO({
reader: Deno.stdin,
writer: Deno.stdout,
})
});rpc.onRequest('textDocument/definition', params => {
return await findDefinition(params);
});rpc.start();
```