Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1193)

Unified Diff: remoting/webapp/base/js/base.js

Issue 1091103002: [Webapp Refactor] Fix styles in SmartReconnector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Indent Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/webapp/crd/js/smart_reconnector.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1cf6a4fb46fc340a4de4e510b514841dd524cafe 100644
--- a/remoting/webapp/base/js/base.js
+++ b/remoting/webapp/base/js/base.js
@@ -682,6 +682,32 @@ base.RepeatingTimer.prototype.dispose = function() {
};
/**
+ * A disposable one shot timer.
+ *
+ * @param {Function} callback
+ * @param {number} timeout
+ *
+ * @constructor
+ * @implements {base.Disposable}
+ */
+base.OneShotTimer = function(callback, timeout) {
+ var that = this;
+
+ /** @private */
+ this.timerId_ = window.setTimeout(function() {
+ that.timerId_ = null;
+ callback();
+ }, timeout);
+};
+
+base.OneShotTimer.prototype.dispose = function() {
+ if (this.timerId_ !== null) {
+ window.clearTimeout(this.timerId_);
+ this.timerId_ = null;
+ }
+};
+
+/**
* Converts UTF-8 string to ArrayBuffer.
*
* @param {string} string
« no previous file with comments | « no previous file | remoting/webapp/crd/js/smart_reconnector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698