MCPcopy Create free account
hub / github.com/TanStack/query / isFocused

Method isFocused

packages/query-core/src/focusManager.ts:130–138  ·  view source on GitHub ↗

* `isFocused` can be used to get the current focus state. * @returns The focus state set with `setFocused`, or otherwise whether the document is visible.

()

Source from the content-addressed store, hash-verified

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/**

Callers 4

onFocusMethod · 0.95
canContinueFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected