Changes to make flatbuffers javascript compatible with the closure compiler.

Change-Id: Iab8d66a8f34910029deb8a5ff5ec7ba50c5b3421
This commit is contained in:
Wouter van Oortmerssen
2017-02-08 17:08:47 -08:00
parent 60b11435e6
commit d7ba17dfe5
5 changed files with 76 additions and 4 deletions

View File

@@ -2,6 +2,15 @@
/// @addtogroup flatbuffers_javascript_api
/// @{
/// @cond FLATBUFFERS_INTERNAL
/**
* @fileoverview
*
* Need to suppress 'global this' error so the Node.js export line doesn't cause
* closure compile to error out.
* @suppress {globalThis}
*/
/**
* @const
* @namespace
@@ -530,6 +539,10 @@ flatbuffers.Builder.prototype.offset = function() {
* @param {flatbuffers.ByteBuffer} bb The current buffer with the existing data
* @returns {flatbuffers.ByteBuffer} A new byte buffer with the old data copied
* to it. The data is located at the end of the buffer.
*
* uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
* it a uint8Array we need to suppress the type check:
* @suppress {checkTypes}
*/
flatbuffers.Builder.growByteBuffer = function(bb) {
var old_buf_size = bb.capacity();