Skip to content

Commit 1f76749

Browse files
committed
Docs: Replaced 'runtime message' with 'message instance' for clarity
1 parent e6b6ded commit 1f76749

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Because JavaScript is a dynamically typed language, protobuf.js introduces the c
114114
115115
There are two possible types of valid messages and the encoder is able to work with both of these:
116116

117-
* **Runtime messages** (explicit instances of message classes with default values on their prototype) always (have to) satisfy the requirements of a valid message and
117+
* **Message instances** (explicit instances of message classes with default values on their prototype) always (have to) satisfy the requirements of a valid message and
118118
* **Plain JavaScript objects** that just so happen to be composed in a way satisfying the requirements of a valid message as well.
119119

120120
In a nutshell, the wire format writer understands the following types:
@@ -152,7 +152,7 @@ With that in mind and again for performance reasons, each message class provides
152152
```
153153

154154
* **Message.encode**(message: `Message|Object` [, writer: `Writer`]): `Writer`<br />
155-
encodes a valid message (**runtime message** or valid **plain JavaScript object**). This method does not implicitly verify the message and it's up to the user to make sure that the payload is a valid message.
155+
encodes a **message instance** or valid **plain JavaScript object**. This method does not implicitly verify the message and it's up to the user to make sure that the payload is a valid message.
156156

157157
```js
158158
var buffer = AwesomeMessage.encode(message).finish();
@@ -162,7 +162,7 @@ With that in mind and again for performance reasons, each message class provides
162162
works like `Message.encode` but additionally prepends the length of the message as a varint.
163163

164164
* **Message.decode**(reader: `Reader|Uint8Array`): `Message`<br />
165-
decodes a buffer to a **runtime message**. If required fields are missing, it throws a `util.ProtocolError` with an `instance` property set to the so far decoded message. If the wire format is invalid, it throws an `Error`.
165+
decodes a buffer to a **message instance**. If required fields are missing, it throws a `util.ProtocolError` with an `instance` property set to the so far decoded message. If the wire format is invalid, it throws an `Error`.
166166

167167
```js
168168
try {
@@ -180,22 +180,22 @@ With that in mind and again for performance reasons, each message class provides
180180
works like `Message.decode` but additionally reads the length of the message prepended as a varint.
181181

182182
* **Message.create**(properties: `Object`): `Message`<br />
183-
creates a new **runtime message** from a set of properties that satisfy the requirements of a valid message. Where applicable, it is recommended to prefer `Message.create` over `Message.fromObject` because it doesn't perform possibly redundant conversion.
183+
creates a new **message instance** from a set of properties that satisfy the requirements of a valid message. Where applicable, it is recommended to prefer `Message.create` over `Message.fromObject` because it doesn't perform possibly redundant conversion.
184184

185185
```js
186186
var message = AwesomeMessage.create({ awesomeField: "AwesomeString" });
187187
```
188188

189189
* **Message.fromObject**(object: `Object`): `Message`<br />
190-
naively converts any non-valid **plain JavaScript object** to a **runtime message**. See the table above for the exact conversion operations performed.
190+
naively converts any non-valid **plain JavaScript object** to a **message instance**. See the table above for the exact conversion operations performed.
191191

192192
```js
193193
var message = AwesomeMessage.fromObject({ awesomeField: 42 });
194194
// converts awesomeField to a string
195195
```
196196

197197
* **Message.toObject**(message: `Message` [, options: `ConversionOptions`]): `Object`<br />
198-
converts a **runtime message** to an arbitrary **plain JavaScript object** for interoperability with other libraries or storage. The resulting plain JavaScript object *might* still satisfy the requirements of a valid message depending on the actual conversion options specified, but most of the time it does not.
198+
converts a **message instance** to an arbitrary **plain JavaScript object** for interoperability with other libraries or storage. The resulting plain JavaScript object *might* still satisfy the requirements of a valid message depending on the actual conversion options specified, but most of the time it does not.
199199

200200
```js
201201
var object = AwesomeMessage.toObject(message, {
@@ -361,7 +361,7 @@ Detailed information on the reflection structure is available within the [API do
361361

362362
### Using custom classes
363363

364-
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:
364+
Message classes can also be extended with custom functionality and it is also possible to register a custom constructor with a reflected message type:
365365

366366
```js
367367
...
@@ -493,7 +493,7 @@ protobuf.load("awesome.proto", function(err, root) {
493493
});
494494
```
495495

496-
**Note:** Dynamically generated runtime message classes cannot be typed, technically, so you must either access its fields using `message["awesomeField"]` notation or you can utilize [typings of its static counterpart](#pbts-for-typescript) for full typings support.
496+
**Note:** Dynamically generated message classes cannot be typed, technically, so you must either access its fields using `message["awesomeField"]` notation or you can utilize [typings of its static counterpart](#pbts-for-typescript) for full typings support.
497497

498498
If you generated static code to `bundle.js` using the CLI and its type definitions to `bundle.d.ts` instead, then you can just do:
499499

@@ -574,7 +574,7 @@ Translates between file formats and generates static code.
574574
--no-comments Does not output any JSDoc comments.
575575
576576
--force-long Enfores the use of 'Long' for s-/u-/int64 and s-/fixed64 fields.
577-
--force-message Enfores the use of runtime messages instead of plain objects.
577+
--force-message Enfores the use of message instances instead of plain objects.
578578
579579
usage: pbjs [options] file1.proto file2.json ... (or) other | pbjs [options] -
580580
```

cli/pbjs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ exports.main = function main(args, callback) {
122122
" --no-comments Does not output any JSDoc comments.",
123123
"",
124124
" --force-long Enfores the use of 'Long' for s-/u-/int64 and s-/fixed64 fields.",
125-
" --force-message Enfores the use of runtime messages instead of plain objects.",
125+
" --force-message Enfores the use of message instances instead of plain objects.",
126126
"",
127127
"usage: " + chalk.bold.green("pbjs") + " [options] file1.proto file2.json ..." + chalk.gray(" (or) ") + "other | " + chalk.bold.green("pbjs") + " [options] -",
128128
""

0 commit comments

Comments
 (0)