Index: remoting/webapp/base/js/base.js |
diff --git a/remoting/webapp/base/js/base.js b/remoting/webapp/base/js/base.js |
index 73a5b3abf20bcfda4466771e2ac7c9cd389bd477..1b2e853175b17cbe7082b37c452249f8f63935c4 100644 |
--- a/remoting/webapp/base/js/base.js |
+++ b/remoting/webapp/base/js/base.js |
@@ -682,6 +682,22 @@ base.RepeatingTimer.prototype.dispose = function() { |
}; |
/** |
+ * A disposable one shot timer. |
+ * |
+ * @constructor |
+ * @implements {base.Disposable} |
+ */ |
+base.OneShotTimer = function(/** Function */ callback, /** number */ timeout) { |
Jamie
2015/04/16 20:05:48
We have used the longer form of jsdoc annotation f
kelvinp
2015/04/16 20:57:58
Done.
|
+ /** @private */ |
+ this.timerId_ = window.setTimeout(callback, timeout); |
+}; |
+ |
+base.OneShotTimer.prototype.dispose = function() { |
+ window.clearTimeout(this.timerId_); |
+ this.timerId_ = null; |
+}; |
+ |
+/** |
* Converts UTF-8 string to ArrayBuffer. |
* |
* @param {string} string |