Skip to main content

Module: browser

Tools for accessing Convex in the browser.

If you are using React, use the react module instead.

Usage

Create a ConvexHttpClient to connect to the Convex Cloud.

import { ConvexHttpClient } from "convex/browser";
// typically loaded from an environment variable
const address = "https://small-mouse-123.convex.cloud";
const convex = new ConvexHttpClient(address);

Classes

Interfaces

Type Aliases

ConvexClientOptions

Ƭ ConvexClientOptions: BaseConvexClientOptions & { disabled?: boolean ; unsavedChangesWarning?: boolean }

Defined in

browser/simple_client.ts:26


FunctionResult

Ƭ FunctionResult: FunctionSuccess | FunctionFailure

The result of running a function on the server.

If the function hit an exception it will have an errorMessage. Otherwise it will produce a Value.

Defined in

browser/sync/function_result.ts:11


OptimisticUpdate

Ƭ OptimisticUpdate<Args>: (localQueryStore: OptimisticLocalStore, args: Args) => void

Type parameters

NameType
Argsextends Record<string, Value>

Type declaration

▸ (localQueryStore, args): void

A temporary, local update to query results within this client.

This update will always be executed when a mutation is synced to the Convex server and rolled back when the mutation completes.

Note that optimistic updates can be called multiple times! If the client loads new data while the mutation is in progress, the update will be replayed again.

Parameters
NameTypeDescription
localQueryStoreOptimisticLocalStoreAn interface to read and edit local query results.
argsArgsThe arguments to the mutation.
Returns

void

Defined in

browser/sync/optimistic_updates.ts:90


QueryJournal

Ƭ QueryJournal: string | null

A serialized representation of decisions made during a query's execution.

A journal is produced when a query function first executes and is re-used when a query is re-executed.

Currently this is used to store pagination end cursors to ensure that pages of paginated queries will always end at the same cursor. This enables gapless, reactive pagination.

null is used to represent empty journals.

Defined in

browser/sync/protocol.ts:111


UserIdentityAttributes

Ƭ UserIdentityAttributes: Omit<UserIdentity, "tokenIdentifier">

Defined in

browser/sync/protocol.ts:159


QueryToken

Ƭ QueryToken: string

A string representing the name and arguments of a query.

This is used by the BaseConvexClient.

Defined in

browser/sync/udf_path_utils.ts:27