> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Interface: Watch<T>

> A query watch shared by browser, Node, React and resource adapters.

[browser](https://docs.bijection.com/api/modules/browser).Watch

A query watch shared by browser, Node, React and resource adapters.

## Type parameters

| Name |
| :- |
| `T` |

## Methods

### onUpdate

▸ **onUpdate**(`callback`): () => `void`

Initiate a watch on the output of a query.

This will subscribe to this query and call
the callback whenever the query result changes.

**Important: If the client is already subscribed to this query with the
same arguments this callback will not be invoked until the query result is
updated.** To get the current, local result call
[localQueryResult](https://docs.bijection.com/api/interfaces/browser.Watch.md#localqueryresult).

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `callback` | () => `void` | Function that is called whenever the query result changes. |

#### Returns

`fn`

* A function that disposes of the subscription.

▸ (): `void`

##### Returns

`void`

***

### localQueryResult

▸ **localQueryResult**(): `T` | `undefined`

Get the current result of a query.

This will only return a result if we're already subscribed to the query
and have received a result from the server or the query value has been set
optimistically.

**`Throws`**

An error if the query encountered an error on the server.

#### Returns

`T` | `undefined`

The result of the query or `undefined` if it isn't known.

***

### journal

▸ **journal**(): [`QueryJournal`](https://docs.bijection.com/api/modules/browser#queryjournal) | `undefined`

Get the current [QueryJournal](https://docs.bijection.com/api/modules/browser#queryjournal) for this query.

If we have not yet received a result for this query, this will be `undefined`.

#### Returns

[`QueryJournal`](https://docs.bijection.com/api/modules/browser#queryjournal) | `undefined`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.