Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 408 Bytes

README.md

File metadata and controls

15 lines (10 loc) · 408 Bytes

While tab visible setTimeout()

setTimeout-like timer that pauses when tab is not visible.

Useful when waiting for browser APIs that are throttled when tab is inactive.

0.7kb uglified, 0.4kb gzipped.

import whileTabVisibleTimeout from 'while-tab-visible-setTimeout';

const cancelTimer = whileTabVisibleTimeout(() => {
    console.log('Tab was active for at least 3 seconds');
}, 3000);