install/freeipa-webui/node_modules/@reduxjs/toolkit/src/query/utils/isDocumentVisible.ts
raw| 1 | /** |
| 2 | * Assumes true for a non-browser env, otherwise makes a best effort |
| 3 | * @link https://developer.mozilla.org/en-US/docs/Web/API/Document/visibilityState |
| 4 | */ |
| 5 | export function isDocumentVisible(): boolean { |
| 6 | // `document` may not exist in non-browser envs (like RN) |
| 7 | if (typeof document === 'undefined') { |
| 8 | return true |
| 9 | } |
| 10 | // Match true for visible, prerender, undefined |
| 11 | return document.visibilityState !== 'hidden' |
| 12 | } |