summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorKamil Rojewski <krojew@users.noreply.github.com>2017-04-10 19:01:13 +0200
committerWouter van Oortmerssen <aardappel@gmail.com>2017-04-10 10:01:13 -0700
commit28e7dbd3d38ae430a5a9c17a36e9321f74476087 (patch)
tree73c79250dd8bdaafaa64370182f17cc372cd6857 /js
parentadc50051e00d8d8568e1c791c30e1da53e6e4b01 (diff)
downloadflatbuffers-28e7dbd3d38ae430a5a9c17a36e9321f74476087.tar.gz
flatbuffers-28e7dbd3d38ae430a5a9c17a36e9321f74476087.tar.bz2
flatbuffers-28e7dbd3d38ae430a5a9c17a36e9321f74476087.zip
TypeScript support (#4232)
* Eclipse ignore * TypeScript support * Prefixing enums * Test results * Merged JS and TS generators * Fixed AppVeyor build problems * Fixed more AppVeyor build problems * Fixed more AppVeyor build problems * Changed TS flag to options struct * Storing options by value * Removed unneeded const * Re-export support for unions * Uint support * Casting bools to numbers for mutation * TS shell tests * Reverted generates js test file to original version * Backing up js tests and properly generating test data
Diffstat (limited to 'js')
-rw-r--r--js/flatbuffers.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/flatbuffers.js b/js/flatbuffers.js
index 4a2bd236..2bb36eac 100644
--- a/js/flatbuffers.js
+++ b/js/flatbuffers.js
@@ -967,6 +967,15 @@ flatbuffers.ByteBuffer.prototype.writeInt16 = function(offset, value) {
* @param {number} offset
* @param {number} value
*/
+flatbuffers.ByteBuffer.prototype.writeUint16 = function(offset, value) {
+ this.bytes_[offset] = value;
+ this.bytes_[offset + 1] = value >> 8;
+};
+
+/**
+ * @param {number} offset
+ * @param {number} value
+ */
flatbuffers.ByteBuffer.prototype.writeInt32 = function(offset, value) {
this.bytes_[offset] = value;
this.bytes_[offset + 1] = value >> 8;
@@ -976,6 +985,17 @@ flatbuffers.ByteBuffer.prototype.writeInt32 = function(offset, value) {
/**
* @param {number} offset
+ * @param {number} value
+ */
+flatbuffers.ByteBuffer.prototype.writeUint32 = function(offset, value) {
+ this.bytes_[offset] = value;
+ this.bytes_[offset + 1] = value >> 8;
+ this.bytes_[offset + 2] = value >> 16;
+ this.bytes_[offset + 3] = value >> 24;
+};
+
+/**
+ * @param {number} offset
* @param {flatbuffers.Long} value
*/
flatbuffers.ByteBuffer.prototype.writeInt64 = function(offset, value) {
@@ -985,6 +1005,15 @@ flatbuffers.ByteBuffer.prototype.writeInt64 = function(offset, value) {
/**
* @param {number} offset
+ * @param {flatbuffers.Long} value
+ */
+flatbuffers.ByteBuffer.prototype.writeUint64 = function(offset, value) {
+ this.writeUint32(offset, value.low);
+ this.writeUint32(offset + 4, value.high);
+};
+
+/**
+ * @param {number} offset
* @param {number} value
*/
flatbuffers.ByteBuffer.prototype.writeFloat32 = function(offset, value) {