Index: remoting/webapp/base.js |
diff --git a/remoting/webapp/base.js b/remoting/webapp/base.js |
index f010d73442483fff07e1cbb998856e9dfc1ac89f..88c3faa3182c65bc60bd0d744f27e73bf01c4380 100644 |
--- a/remoting/webapp/base.js |
+++ b/remoting/webapp/base.js |
@@ -12,7 +12,7 @@ |
'use strict'; |
var base = {}; |
-base.debug = function () {}; |
+base.debug = function() {}; |
/** |
* Whether to break in debugger and alert when an assertion fails. |
@@ -104,7 +104,7 @@ base.doNothing = function() {}; |
* @param {!Object} dict |
* @return {Array} |
*/ |
-base.values = function (dict) { |
+base.values = function(dict) { |
return Object.keys(dict).map( |
/** @param {string} key */ |
function(key) { |
@@ -112,6 +112,20 @@ base.values = function (dict) { |
}); |
}; |
+base.Promise = function() {}; |
+ |
+/** |
+ * @param {number} delay |
+ * @return {Promise} a Promise that will be fulfilled after |delay| ms. |
+ */ |
+base.Promise.sleep = function(delay) { |
+ return new Promise( |
+ /** @param {function():void} fulfill */ |
+ function(fulfill) { |
+ window.setTimeout(fulfill, delay); |
+ }); |
+}; |
+ |
/** |
* A mixin for classes with events. |
* |