* Cancels a timeout. * @param {Timeout | string | number} timer * @returns {void}
(timer)
| 134 | * @returns {void} |
| 135 | */ |
| 136 | function clearTimeout(timer) { |
| 137 | if (timer?._onTimeout) { |
| 138 | timer._onTimeout = null; |
| 139 | unenroll(timer); |
| 140 | return; |
| 141 | } |
| 142 | if (typeof timer === 'number' || typeof timer === 'string') { |
| 143 | const timerInstance = knownTimersById[timer]; |
| 144 | if (timerInstance !== undefined) { |
| 145 | timerInstance._onTimeout = null; |
| 146 | unenroll(timerInstance); |
| 147 | } |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Schedules repeated execution of `callback` |
no test coverage detected
searching dependent graphs…