diff options
Diffstat (limited to 'js/binary/constants.js')
-rw-r--r-- | js/binary/constants.js | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/js/binary/constants.js b/js/binary/constants.js index a976e0b6..836216bf 100644 --- a/js/binary/constants.js +++ b/js/binary/constants.js @@ -41,11 +41,16 @@ goog.provide('jspb.BinaryMessage'); goog.provide('jspb.BuilderFunction'); goog.provide('jspb.ByteSource'); goog.provide('jspb.ClonerFunction'); +goog.provide('jspb.ComparerFunction'); goog.provide('jspb.ConstBinaryMessage'); +goog.provide('jspb.PrunerFunction'); goog.provide('jspb.ReaderFunction'); goog.provide('jspb.RecyclerFunction'); +goog.provide('jspb.RepeatedFieldType'); +goog.provide('jspb.ScalarFieldType'); goog.provide('jspb.WriterFunction'); + goog.forwardDeclare('jspb.Message'); goog.forwardDeclare('jsproto.BinaryExtension'); @@ -79,11 +84,29 @@ jspb.ByteSource; /** + * A scalar field in jspb can be a boolean, number, or string. + * @typedef {boolean|number|string} + */ +jspb.ScalarFieldType; + + +/** + * A repeated field in jspb is an array of scalars, blobs, or messages. + * @typedef {!Array<jspb.ScalarFieldType>| + !Array<!Uint8Array>| + !Array<!jspb.BinaryMessage>} + */ +jspb.RepeatedFieldType; + + +/** * A field in jspb can be a scalar, a block of bytes, another proto, or an * array of any of the above. - * @typedef {boolean|number|string|Uint8Array| - jspb.BinaryMessage|jsproto.BinaryExtension| - Array<jspb.AnyFieldType>} + * @typedef {jspb.ScalarFieldType| + jspb.RepeatedFieldType| + !Uint8Array| + !jspb.BinaryMessage| + !jsproto.BinaryExtension} */ jspb.AnyFieldType; @@ -125,6 +148,23 @@ jspb.WriterFunction; /** + * A pruner function removes default-valued fields and empty submessages from a + * message and returns either the pruned message or null if the entire message + * was pruned away. + * @typedef {function(?jspb.BinaryMessage):?jspb.BinaryMessage} + */ +jspb.PrunerFunction; + + +/** + * A comparer function returns true if two protos are equal. + * @typedef {!function(?jspb.ConstBinaryMessage, + * ?jspb.ConstBinaryMessage):boolean} + */ +jspb.ComparerFunction; + + +/** * Field type codes, taken from proto2/public/wire_format_lite.h. * @enum {number} */ |