aboutsummaryrefslogtreecommitdiff
path: root/src/closure-externs.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-07 15:40:53 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-07 15:40:53 -0800
commit0b3416a1dcd808fb71043a9f400f3ef2aa636abc (patch)
tree9a7ff926af193e432f5646afbcfb2c7365b17879 /src/closure-externs.js
parent6fee37fceb9e06a805c8074aa68bf678f406ff5b (diff)
parente4e8063f6d568277b297f19d51801cd7dda9545c (diff)
Merge branch 'incoming' into llvm-3.41.8.6
Conflicts: tests/test_benchmark.py tools/shared.py
Diffstat (limited to 'src/closure-externs.js')
-rw-r--r--src/closure-externs.js110
1 files changed, 110 insertions, 0 deletions
diff --git a/src/closure-externs.js b/src/closure-externs.js
new file mode 100644
index 00000000..a82aa669
--- /dev/null
+++ b/src/closure-externs.js
@@ -0,0 +1,110 @@
+/**
+ * This file contains definitions for things that we'd really rather the closure compiler *didn't* minify.
+ * See http://code.google.com/p/closure-compiler/wiki/FAQ#How_do_I_write_an_externs_file
+ * See also the discussion here: https://github.com/kripken/emscripten/issues/1979
+ *
+ * The closure_compiler() method in tools/shared.py refers to this file when calling closure.
+ */
+
+// Closure externs used by library_uuid.js
+
+/**
+ * @param {Array} typedArray
+ */
+crypto.getRandomValues = function(typedArray) {};
+
+/**
+ BEGIN_NODE_INCLUDE
+ var crypto = require('crypto');
+ END_NODE_INCLUDE
+ */
+
+/**
+ * @type {Object.<string,*>}
+ */
+var crypto = {};
+
+/**
+ * @param {number} size
+ * @param {function(Error, buffer.Buffer)} callback
+ */
+crypto.randomBytes = function(size, callback) {};
+
+
+// Closure externs used by library_sockfs.js
+
+/**
+ BEGIN_NODE_INCLUDE
+ var ws = require('ws');
+ END_NODE_INCLUDE
+ */
+
+/**
+ * @type {Object.<string,*>}
+ */
+var ws = {};
+
+/**
+ * @param {string} event
+ * @param {function()} callback
+ */
+ws.on = function(event, callback) {};
+
+/**
+ * @param {Object} data
+ * @param {Object} flags
+ * @param {function()=} callback
+ */
+ws.send = function(data, flags, callback) {};
+
+/**
+* @type {boolean}
+*/
+ws.binaryType;
+
+/**
+ * @type {Object.<string,*>}
+ */
+var wss = ws.Server;
+
+/**
+ * @param {string} event
+ * @param {function()} callback
+ */
+wss.on = function(event, callback) {};
+
+/**
+ * @param {function()} callback
+ */
+wss.broadcast = function(callback) {};
+
+/**
+* @type {Object.<string,*>}
+*/
+wss._socket;
+
+/**
+* @type {string}
+*/
+wss.url;
+
+/**
+* @type {string}
+*/
+wss._socket.remoteAddress;
+
+/**
+* @type {number}
+*/
+wss._socket.remotePort;
+
+/**
+* @type {Object.<string,*>}
+*/
+var flags = {};
+/**
+* @type {boolean}
+*/
+flags.binary;
+
+