| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @fileoverview Provides an implementation of the SystemTimer interface based | 6 * @fileoverview Provides an implementation of the SystemTimer interface based |
| 7 * on window's timer methods. | 7 * on window's timer methods. |
| 8 */ | 8 */ |
| 9 'use strict'; | 9 'use strict'; |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Creates an implementation of the SystemTimer interface based on window's | 12 * Creates an implementation of the SystemTimer interface based on window's |
| 13 * timer methods. | 13 * timer methods. |
| 14 * @constructor | 14 * @constructor |
| 15 * @implements {SystemTimer} | 15 * @implements {SystemTimer} |
| 16 */ | 16 */ |
| 17 function WindowTimer() { | 17 function WindowTimer() {} |
| 18 } | |
| 19 | 18 |
| 20 /** | 19 /** |
| 21 * Sets a single-shot timer. | 20 * Sets a single-shot timer. |
| 22 * @param {function()} func Called back when the timer expires. | 21 * @param {function()} func Called back when the timer expires. |
| 23 * @param {number} timeoutMillis How long until the timer fires, in | 22 * @param {number} timeoutMillis How long until the timer fires, in |
| 24 * milliseconds. | 23 * milliseconds. |
| 25 * @return {number} A timeout ID, which can be used to cancel the timer. | 24 * @return {number} A timeout ID, which can be used to cancel the timer. |
| 26 */ | 25 */ |
| 27 WindowTimer.prototype.setTimeout = function(func, timeoutMillis) { | 26 WindowTimer.prototype.setTimeout = function(func, timeoutMillis) { |
| 28 return window.setTimeout(func, timeoutMillis); | 27 return window.setTimeout(func, timeoutMillis); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 47 return window.setInterval(func, timeoutMillis); | 46 return window.setInterval(func, timeoutMillis); |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 /** | 49 /** |
| 51 * Clears a previously set interval timer. | 50 * Clears a previously set interval timer. |
| 52 * @param {number} timeoutId The ID of the timer to clear. | 51 * @param {number} timeoutId The ID of the timer to clear. |
| 53 */ | 52 */ |
| 54 WindowTimer.prototype.clearInterval = function(timeoutId) { | 53 WindowTimer.prototype.clearInterval = function(timeoutId) { |
| 55 window.clearInterval(timeoutId); | 54 window.clearInterval(timeoutId); |
| 56 }; | 55 }; |
| OLD | NEW |