* Creates a new Pass instance. * @param {!Window} win * @param {function()} handler Handler to be executed when pass is triggered. * @param {number=} opt_defaultDelay Default delay to be used when schedule * is called without one.
(win, handler, opt_defaultDelay)
| 14 | * is called without one. |
| 15 | */ |
| 16 | constructor(win, handler, opt_defaultDelay) { |
| 17 | this.timer_ = Services.timerFor(win); |
| 18 | |
| 19 | /** @private @const {function()} */ |
| 20 | this.handler_ = handler; |
| 21 | |
| 22 | /** @private @const {number} */ |
| 23 | this.defaultDelay_ = opt_defaultDelay || 0; |
| 24 | |
| 25 | /** @private {number|string} */ |
| 26 | this.scheduled_ = -1; |
| 27 | |
| 28 | /** @private {number} */ |
| 29 | this.nextTime_ = 0; |
| 30 | |
| 31 | /** @private {boolean} */ |
| 32 | this.running_ = false; |
| 33 | |
| 34 | /** |
| 35 | * @private |
| 36 | * @const {function()} |
| 37 | */ |
| 38 | this.boundPass_ = () => { |
| 39 | this.pass_(); |
| 40 | }; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Whether or not a pass is currently pending. |