* Returns a promise that will resolve after the delay. Optionally, the * resolved value can be provided as opt_result argument. * @param {number=} opt_delay * @return {!Promise}
(opt_delay)
| 103 | * @return {!Promise} |
| 104 | */ |
| 105 | promise(opt_delay) { |
| 106 | return new this.win.Promise((resolve) => { |
| 107 | // Avoid wrapping in closure if no specific result is produced. |
| 108 | const timerKey = this.delay(resolve, opt_delay); |
| 109 | if (timerKey == -1) { |
| 110 | throw new Error('Failed to schedule timer.'); |
| 111 | } |
| 112 | }); |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Returns a promise that will fail after the specified delay. Optionally, |
no test coverage detected