* Calculates the minimum time that a timeout should have right now. * @param {number|undefined} time * @return {number|undefined}
(time)
| 245 | * @return {number|undefined} |
| 246 | */ |
| 247 | function minTime(time) { |
| 248 | if (!inViewport) { |
| 249 | time += 1000; |
| 250 | } |
| 251 | // Eventually this should throttle like this: |
| 252 | // - for timeouts in the order of a frame use requestAnimationFrame |
| 253 | // instead. |
| 254 | // - only allow about 2-4 short timeouts (< 16ms) in a 16ms time frame. |
| 255 | // Throttle further timeouts to requestAnimationFrame. |
| 256 | return time; |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Installs embed state listener. |
no outgoing calls
no test coverage detected