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

Unified Diff: ui/webui/resources/js/cr/ui/repeating_button.js

Issue 543493002: Compile chrome://settings, part 2: reduce from 950 to 400 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@F_settings
Patch Set: rebase? rebase! Created 6 years, 3 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 | « ui/webui/resources/js/cr/ui/position_util.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/cr/ui/repeating_button.js
diff --git a/ui/webui/resources/js/cr/ui/repeating_button.js b/ui/webui/resources/js/cr/ui/repeating_button.js
index 35f235644bf777778539c1d08f128ce2cb316be5..696ff9f4318fbc958eb17727896da3da5f57ad70 100644
--- a/ui/webui/resources/js/cr/ui/repeating_button.js
+++ b/ui/webui/resources/js/cr/ui/repeating_button.js
@@ -38,22 +38,22 @@ cr.define('cr.ui', function() {
holdRepeatIntervalTime_: 50,
/**
- * Callback function when repeated intervals trigger. Initialized when the
- * button is held for an initial delay period and cleared when the button
- * is released.
- * @type {function}
+ * Callback function ID when repeated intervals trigger. Initialized when
+ * the button is held for an initial delay period and cleared when the
+ * button is released.
+ * @type {number|undefined}
* @private
*/
- intervalCallback_: undefined,
+ intervalCallbackId_: undefined,
/**
* Callback function to arm the repeat timer. Initialized when the button
* is pressed and cleared when the interval timer is set or the button is
* released.
- * @type {function}
+ * @type {number|undefined}
* @private
*/
- armRepeaterCallback_: undefined,
+ armRepeaterCallbackId_: undefined,
/**
* Initializes the button.
@@ -97,18 +97,19 @@ cr.define('cr.ui', function() {
// initial delay and repeat interval.
this.buttonHeld_();
var self = this;
- this.armRepeaterCallback_ = function() {
+ var armRepeaterCallback = function() {
// In the event of a click/tap operation, this button has already been
// released by the time this timeout triggers. Test to ensure that the
// button is still being held (i.e. clearTimeout has not been called).
- if (self.armRepeaterCallback_) {
- self.armRepeaterCallback_ = undefined;
+ if (typeof self.armRepeaterCallbackId_ != 'undefined') {
+ self.armRepeaterCallbackId_ = undefined;
self.buttonHeld_();
- self.intervalCallback_ = setInterval(self.buttonHeld_.bind(self),
- self.holdRepeatIntervalTime_);
+ self.intervalCallbackId_ = setInterval(self.buttonHeld_.bind(self),
+ self.holdRepeatIntervalTime_);
}
};
- setTimeout(this.armRepeaterCallback_, this.holdDelayTime_);
+ this.armRepeaterCallbackId_ = setTimeout(armRepeaterCallback,
+ this.holdDelayTime_);
},
/**
@@ -125,13 +126,13 @@ cr.define('cr.ui', function() {
* @private
*/
clearTimeout_: function() {
- if (this.armRepeaterCallback_) {
- clearTimeout(this.armRepeaterCallback_);
- this.armRepeaterCallback_ = undefined;
+ if (typeof this.armRepeaterCallbackId_ != 'undefined') {
+ clearTimeout(this.armRepeaterCallbackId_);
+ this.armRepeaterCallbackId_ = undefined;
}
- if (this.intervalCallback_) {
- clearInterval(this.intervalCallback_);
- this.intervalCallback_ = undefined;
+ if (typeof this.intervalCallbackId_ != 'undefined') {
+ clearInterval(this.intervalCallbackId_);
+ this.intervalCallbackId_ = undefined;
}
},
« no previous file with comments | « ui/webui/resources/js/cr/ui/position_util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698