()
| 188 | } |
| 189 | |
| 190 | function refreshTimeout () { |
| 191 | // If the fastNowTimeout is already set and the Timer has the refresh()- |
| 192 | // method available, call it to refresh the timer. |
| 193 | // Some timer objects returned by setTimeout may not have a .refresh() |
| 194 | // method (e.g. mocked timers in tests). |
| 195 | if (fastNowTimeout?.refresh) { |
| 196 | fastNowTimeout.refresh() |
| 197 | // fastNowTimeout is not instantiated yet or refresh is not availabe, |
| 198 | // create a new Timer. |
| 199 | } else { |
| 200 | clearTimeout(fastNowTimeout) |
| 201 | fastNowTimeout = setTimeout(onTick, TICK_MS) |
| 202 | // If the Timer has an unref method, call it to allow the process to exit, |
| 203 | // if there are no other active handles. When using fake timers or mocked |
| 204 | // environments (like Jest), .unref() may not be defined, |
| 205 | fastNowTimeout?.unref() |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * The `FastTimer` class is a data structure designed to store and manage |
no test coverage detected
searching dependent graphs…