mirror of https://github.com/grpc/grpc-web.git
md linter
This commit is contained in:
parent
6272637894
commit
80358bbeaa
34
README.md
34
README.md
|
|
@ -1,6 +1,6 @@
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
gRPC-Web provides a Javascript library that lets browser clients access a gRPC
|
gRPC-Web provides a JavaScript library that lets browser clients access a gRPC
|
||||||
service. You can find out much more about gRPC in its own
|
service. You can find out much more about gRPC in its own
|
||||||
[website](https://grpc.io).
|
[website](https://grpc.io).
|
||||||
|
|
||||||
|
|
@ -103,9 +103,11 @@ also supported.
|
||||||
typings file will also be generated for the protobuf messages and service stub.
|
typings file will also be generated for the protobuf messages and service stub.
|
||||||
|
|
||||||
`import_style=typescript`: (Experimental) The service stub will be generated
|
`import_style=typescript`: (Experimental) The service stub will be generated
|
||||||
in TypeScript. See **Typescript Support** below for information on how to generate Typescript files.
|
in TypeScript. See **TypeScript Support** below for information on how to
|
||||||
|
generate TypeScript files.
|
||||||
|
|
||||||
**Note: The `commonjs+dts` and `typescript` styles are only supported by `--grpc-web_out=import_style=...`, not by `--js_out=import_style=...`.**
|
**Note: The `commonjs+dts` and `typescript` styles are only supported by
|
||||||
|
`--grpc-web_out=import_style=...`, not by `--js_out=import_style=...`.**
|
||||||
|
|
||||||
### Wire Format Mode
|
### Wire Format Mode
|
||||||
|
|
||||||
|
|
@ -249,15 +251,16 @@ either:
|
||||||
- `import_style=commonjs+dts`: existing CommonJS style stub + `.d.ts` typings
|
- `import_style=commonjs+dts`: existing CommonJS style stub + `.d.ts` typings
|
||||||
- `import_style=typescript`: full TypeScript output
|
- `import_style=typescript`: full TypeScript output
|
||||||
|
|
||||||
Do *not* use `import_style=typescript` for `--js_out`, it will silently be ignored.
|
Do *not* use `import_style=typescript` for `--js_out`, it will silently be
|
||||||
Instead you should use `--js_out=import_style=commonjs`, or `--js_out=import_style=commonjs,binary`
|
ignored. Instead you should use `--js_out=import_style=commonjs`, or
|
||||||
if you are using `mode=grpcweb`. The `--js_out` plugin will generate Javascript code
|
`--js_out=import_style=commonjs,binary` if you are using `mode=grpcweb`. The
|
||||||
(`echo_pb.js`), and the `-grpc-web_out` plugin will generate a TypeScript definition file
|
`--js_out` plugin will generate JavaScript code (`echo_pb.js`), and the
|
||||||
for it (`echo_pb.d.ts`). This is a temporary hack until the `--js_out` supports TypeScript
|
`-grpc-web_out` plugin will generate a TypeScript definition file for it
|
||||||
itself.
|
(`echo_pb.d.ts`). This is a temporary hack until the `--js_out` supports
|
||||||
|
TypeScript itself.
|
||||||
|
|
||||||
For example, this is the command you should use to generate TypeScript code using the
|
For example, this is the command you should use to generate TypeScript code
|
||||||
binary wire format:
|
using the binary wire format
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ protoc -I=$DIR echo.proto \
|
$ protoc -I=$DIR echo.proto \
|
||||||
|
|
@ -267,9 +270,12 @@ $ protoc -I=$DIR echo.proto \
|
||||||
|
|
||||||
It will generate the following files:
|
It will generate the following files:
|
||||||
|
|
||||||
* `echo_gprc_web_pb.ts` - Generated by `--grpc-web_out`, contains the TypeScript gRPC-web code.
|
* `echo_grpc_web_pb.ts` - Generated by `--grpc-web_out`, contains the
|
||||||
* `echo_pb.js` - Generated by `--js_out`, contains the JavaScript Protobuf code.
|
TypeScript gRPC-web code.
|
||||||
* `echo_pb.d.ts` - Generated by `--grpc-web_out`, contains TypeScript definitions for `echo_pb.js`.
|
* `echo_pb.js` - Generated by `--js_out`, contains the JavaScript Protobuf
|
||||||
|
code.
|
||||||
|
* `echo_pb.d.ts` - Generated by `--grpc-web_out`, contains TypeScript
|
||||||
|
definitions for `echo_pb.js`.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import * as grpcWeb from 'grpc-web';
|
import * as grpcWeb from 'grpc-web';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue