* `isFocused` can be used to get the current focus state. * @returns The focus state set with `setFocused`, or otherwise whether the document is visible.
()
| 128 | * @returns The focus state set with `setFocused`, or otherwise whether the document is visible. |
| 129 | */ |
| 130 | isFocused(): boolean { |
| 131 | if (typeof this.#focused === 'boolean') { |
| 132 | return this.#focused |
| 133 | } |
| 134 | |
| 135 | // document global can be unavailable in react native |
| 136 | // oxlint-disable-next-line typescript/no-unnecessary-condition |
| 137 | return globalThis.document?.visibilityState !== 'hidden' |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | /** |
no outgoing calls
no test coverage detected