summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2017-04-17 17:31:03 -0700
committerWouter van Oortmerssen <aardappel@gmail.com>2017-04-17 17:31:03 -0700
commitb627b7c6c60f5fb24d73c8915b73e4d9e0fd176d (patch)
tree1ac95bf24b464e2d13217055850f930b6dd01314 /js
parente093f72d0087aff3d1edd193a20a879782323c01 (diff)
downloadflatbuffers-b627b7c6c60f5fb24d73c8915b73e4d9e0fd176d.tar.gz
flatbuffers-b627b7c6c60f5fb24d73c8915b73e4d9e0fd176d.tar.bz2
flatbuffers-b627b7c6c60f5fb24d73c8915b73e4d9e0fd176d.zip
Undo PR: make flatbuffers.js into a UMD module (#4228)
This PR did not work in all JS environments and caused downstream breakage. Change-Id: Ib565129e26622d02bad2d45816bd05f6b961b994
Diffstat (limited to 'js')
-rw-r--r--js/flatbuffers.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/js/flatbuffers.js b/js/flatbuffers.js
index 2bb36eac..ccbd362a 100644
--- a/js/flatbuffers.js
+++ b/js/flatbuffers.js
@@ -3,14 +3,18 @@
/// @{
/// @cond FLATBUFFERS_INTERNAL
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = { flatbuffers: factory() } :
- typeof define === 'function' && define.amd ? define(factory) :
- (global.flatbuffers = factory());
-}(this, (function () { 'use strict';
-/**
-* @exports flatbuffers
-*/
+/**
+ * @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
+ */
var flatbuffers = {};
/**
@@ -1185,9 +1189,8 @@ flatbuffers.ByteBuffer.prototype.createLong = function(low, high) {
return flatbuffers.Long.create(low, high);
};
-return flatbuffers;
-
-})));
+// Exports for Node.js and RequireJS
+this.flatbuffers = flatbuffers;
/// @endcond
/// @}