You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library utilizes a JSON format that is equivalent to a .proto definition. For example, the following is identical to the .proto definition seen above:
255
+
The library utilizes JSON descriptors that are equivalent to a .proto definition. For example, the following is identical to the .proto definition seen above:
256
256
257
257
```json
258
258
// awesome.json
@@ -270,24 +270,26 @@ The library utilizes a JSON format that is equivalent to a .proto definition. Fo
270
270
}
271
271
```
272
272
273
-
The JSON format closely resembles the internal reflection structure:
273
+
JSON descriptors closely resemble the internal reflection structure:
var jsonDescriptor =require("./awesome.json"); // exemplary for node
@@ -311,7 +313,7 @@ var root = protobuf.Root.fromJSON(jsonDescriptor);
311
313
312
314
### Using reflection only
313
315
314
-
Both the full and the light library include full reflection support. You could, for example, define the .proto definitions seen in the examples above using just reflection:
316
+
Both the full and the light library include full reflection support. One could, for example, define the .proto definitions seen in the examples above using just reflection:
315
317
316
318
```js
317
319
...
@@ -331,21 +333,21 @@ Detailed information on the reflection structure is available within the [docume
331
333
332
334
### Using custom classes
333
335
334
-
You can also extend runtime message classes with your own custom functionality and even register your own constructor with a reflected message type:
336
+
Runtime message classes can also be extended with custom functionality and it is also possible to register a custom constructor with a reflected message type:
335
337
336
338
```js
337
339
...
338
340
339
-
// Define your own constructor
341
+
// Define a custom constructor
340
342
functionAwesomeMessage(properties) {
341
343
// custom initialization code
342
344
...
343
345
}
344
346
345
-
// Register your constructor with its reflected type (*)
347
+
// Register the custom constructor with its reflected type (*)
Command line usage has moved to the (soon to be decoupled) [CLI package]((./cli/README.md))
499
+
Command line usage has moved to the (soon to be decoupled) [CLI package](./cli/README.md)
498
500
499
501
Performance
500
502
-----------
@@ -576,7 +578,7 @@ Compatibility
576
578
* If typed arrays are not supported by the environment, plain arrays will be used instead.
577
579
* Support for pre-ES5 environments (except IE8) can be achieved by [using a polyfill](https://github.com/dcodeIO/protobuf.js/blob/master/scripts/polyfill.js).
578
580
* Support for [Content Security Policy](https://w3c.github.io/webappsec-csp/)-restricted environments (like Chrome extensions without [unsafe-eval](https://developer.chrome.com/extensions/contentSecurityPolicy#relaxing-eval)) can be achieved by generating and using static code instead.
579
-
* If you need a proper way to work with 64 bit values (uint64, int64 etc.), you can install [long.js](https://github.com/dcodeIO/long.js) alongside this library. All 64 bit numbers will then be returned as a `Long` instance instead of a possibly unsafe JavaScript number ([see](https://github.com/dcodeIO/long.js)).
581
+
* If a proper way to work with 64 bit values (uint64, int64 etc.) is required, just install [long.js](https://github.com/dcodeIO/long.js) alongside this library. All 64 bit numbers will then be returned as a `Long` instance instead of a possibly unsafe JavaScript number ([see](https://github.com/dcodeIO/long.js)).
580
582
581
583
Building
582
584
--------
@@ -609,9 +611,9 @@ $> npm run types
609
611
610
612
### Browserify integration
611
613
612
-
By default, protobuf.js integrates into your browserify build-process without requiring any optional modules. Hence:
614
+
By default, protobuf.js integrates into any browserify build-process without requiring any optional modules. Hence:
613
615
614
-
* If you need int64 support, explicitly require the `long` module somewhere in your project as it will be excluded otherwise. This assumes that a global `require` function is present that protobuf.js can call to obtain the long module.
616
+
* If int64 support is required, explicitly require the `long` module somewhere in your project as it will be excluded otherwise. This assumes that a global `require` function is present that protobuf.js can call to obtain the long module.
615
617
616
618
If there is no global `require` function present after bundling, it's also possible to assign the long module programmatically:
0 commit comments