new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

TanStack Query · Reference · all subjects

focusmanager

9 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

focusManager.isFocused example

Example of isFocused usage: const isFocused = focusManager.isFocused()

FocusManager purpose and methods

The FocusManager manages the focus state within TanStack Query. It can be used to change the default event listeners or to manually change the focus state. Its available methods are setEventListener, subscribe, setFocused, and isFocused.

focusManager.setEventListener usage

setEventListener can be used to set a custom event listener. It accepts a callback that receives a handleFocus function and should set up event listeners. The callback must return an unsubscribe function that cleans up the event listeners.

focusManager.setEventListener example with visibilitychange

Example showing setEventListener with a visibilitychange listener: import { focusManager } from '@tanstack/react-query' focusManager.setEventListener((handleFocus) => { // Listen to visibilitychange if (typeof window !== 'undefined' && window.addEventListener) { window.addEventListener('visibilitychange', handleFocus, false) } return () => { // Be sure to unsubscribe if a new handler is set window.removeEventListener('visibilitychange', handleFocus) } })

focusManager.subscribe usage

subscribe can be used to subscribe to changes in the visibility state. It accepts a callback that receives an isVisible boolean parameter and returns an unsubscribe function.

focusManager.subscribe example

Example showing subscribe to visibility state changes: import { focusManager } from '@tanstack/react-query' const unsubscribe = focusManager.subscribe((isVisible) => { console.log('isVisible', isVisible) })

focusManager.setFocused usage

setFocused can be used to manually set the focus state. It accepts a focused parameter of type boolean | undefined. Setting undefined causes it to fall back to the default focus check.

focusManager.setFocused examples

Examples of setFocused usage: import { focusManager } from '@tanstack/react-query' // Set focused focusManager.setFocused(true) // Set unfocused focusManager.setFocused(false) // Fallback to the default focus check focusManager.setFocused(undefined)

focusManager.isFocused usage

isFocused can be used to get the current focus state. It returns a boolean value indicating whether the window is currently focused.

Give your agent this brain