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
3 // found in the LICENSE file.
6 * @fileoverview Provides a countdown-based timer interface.
14 function Countdown() {}
17 * Sets a new timeout for this timer.
18 * @param {number} timeoutMillis how long, in milliseconds, the countdown lasts.
19 * @param {Function=} cb called back when the countdown expires.
20 * @return {boolean} whether the timeout could be set.
22 Countdown.prototype.setTimeout = function(timeoutMillis, cb) {};
24 /** Clears this timer's timeout. Timers that are cleared become expired. */
25 Countdown.prototype.clearTimeout = function() {};
28 * @return {number} how many milliseconds are remaining until the timer expires.
30 Countdown.prototype.millisecondsUntilExpired = function() {};
32 /** @return {boolean} whether the timer has expired. */
33 Countdown.prototype.expired = function() {};
36 * Constructs a new clone of this timer, while overriding its callback.
37 * @param {Function=} cb callback for new timer.
38 * @return {!Countdown} new clone.
40 Countdown.prototype.clone = function(cb) {};
43 * A factory to create countdown timers.
46 function CountdownFactory() {}
49 * Creates a new timer.
50 * @param {number} timeoutMillis How long, in milliseconds, the countdown lasts.
51 * @param {function()=} opt_cb Called back when the countdown expires.
52 * @return {!Countdown} The timer.
54 CountdownFactory.prototype.createTimer = function(timeoutMillis, opt_cb) {};