| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Class to handle changes to auto-scan. | 6 * Class to handle changes to auto-scan. |
| 7 * | 7 * |
| 8 * @constructor | 8 * @constructor |
| 9 * @param {SwitchAccessInterface} switchAccess | 9 * @param {SwitchAccessInterface} switchAccess |
| 10 */ | 10 */ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 /** | 25 /** |
| 26 * Length of auto-scan interval in milliseconds. | 26 * Length of auto-scan interval in milliseconds. |
| 27 * | 27 * |
| 28 * @private {number} | 28 * @private {number} |
| 29 */ | 29 */ |
| 30 this.scanTime_ = switchAccess.switchAccessPrefs.getNumberPref('autoScanTime'); | 30 this.scanTime_ = switchAccess.switchAccessPrefs.getNumberPref('autoScanTime'); |
| 31 | 31 |
| 32 let enabled = switchAccess.switchAccessPrefs.getBooleanPref('enableAutoScan'); | 32 let enabled = switchAccess.switchAccessPrefs.getBooleanPref('enableAutoScan'); |
| 33 if (enabled) | 33 if (enabled) |
| 34 this.start_(); | 34 this.start_(); |
| 35 }; | 35 } |
| 36 | 36 |
| 37 AutoScanManager.prototype = { | 37 AutoScanManager.prototype = { |
| 38 /** | 38 /** |
| 39 * Stop the window from moving to the next node at a fixed interval. | 39 * Stop the window from moving to the next node at a fixed interval. |
| 40 * | 40 * |
| 41 * @private | 41 * @private |
| 42 */ | 42 */ |
| 43 stop_: function() { | 43 stop_: function() { |
| 44 window.clearInterval(this.intervalID_); | 44 window.clearInterval(this.intervalID_); |
| 45 this.intervalID_ = undefined; | 45 this.intervalID_ = undefined; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 * Update this.scanTime_ to |scanTime|. Then, if auto-scan is currently | 93 * Update this.scanTime_ to |scanTime|. Then, if auto-scan is currently |
| 94 * running, restart it. | 94 * running, restart it. |
| 95 * | 95 * |
| 96 * @param {number} scanTime Auto-scan interval time in milliseconds. | 96 * @param {number} scanTime Auto-scan interval time in milliseconds. |
| 97 */ | 97 */ |
| 98 setScanTime: function(scanTime) { | 98 setScanTime: function(scanTime) { |
| 99 this.scanTime_ = scanTime; | 99 this.scanTime_ = scanTime; |
| 100 this.restartIfRunning(); | 100 this.restartIfRunning(); |
| 101 }, | 101 }, |
| 102 }; | 102 }; |
| OLD | NEW |