Index: remoting/webapp/base/js/base.js |
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js |
index f34b2e24ec651557c427b65413744652acaf42f7..4f4a202daa2cdafbf0536ba7d1f99420ff3724a2 100644 |
--- a/remoting/webapp/base/js/base.js |
+++ b/remoting/webapp/base/js/base.js |
@@ -56,6 +56,15 @@ base.debug.callstack = function() { |
}; |
/** |
+ * @param {*} value |
+ * @return T |
+ * @template T |
+ */ |
+base.reinterpret_cast = function(value) { |
Jamie
2015/04/07 01:13:11
You don't seem to be using this.
John Williams
2015/04/07 20:10:25
Yeah, I thought this would make certain casts less
|
+ return value; |
+}; |
+ |
+/** |
* @interface |
*/ |
base.Disposable = function() {}; |
@@ -734,3 +743,19 @@ base.resizeWindowToContent = function() { |
// so restore it explicitly. |
appWindow.moveTo(outerBounds.left, outerBounds.top); |
}; |
+ |
+/** |
+ * @return {string} A random UUID. |
+ */ |
+base.generateUuid = function() { |
Jamie
2015/04/07 01:13:12
Move this up below generateXsrfToken, since it's c
John Williams
2015/04/07 20:10:25
Done.
|
+ var random = new Uint16Array(8); |
+ window.crypto.getRandomValues(random); |
+ /** @type {Array<string>} */ |
+ var e = new Array(); |
+ for (var i = 0; i < 8; i++) { |
+ e[i] = (/** @type {number} */ (random[i]) + 0x10000). |
+ toString(16).substring(1); |
+ } |
+ return e[0] + e[1] + '-' + e[2] + '-' + e[3] + '-' + |
+ e[4] + '-' + e[5] + e[6] + e[7]; |
+}; |