Function
idleTimer
(message: string, reject: (error: Error) => void, delay = 5000)
Source from the content-addressed store, hash-verified
| 95 | * reset before the delay elapses. |
| 96 | */ |
| 97 | export function idleTimer(message: string, reject: (error: Error) => void, delay = 5000) { |
| 98 | const start = () => setTimeout(() => reject(new Error(message)), delay) |
| 99 | let timeout = start() |
| 100 | return { |
| 101 | reset: () => { |
| 102 | clearTimeout(timeout) |
| 103 | timeout = start() |
| 104 | }, |
| 105 | dispose: () => { |
| 106 | clearTimeout(timeout) |
| 107 | }, |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * If using a proxy, return the address of the proxy. |
Tested by
no test coverage detected