Skip to content

BrowserClientOptions

BrowserClientOptions<S> = object

Options for createClient.

S is one site’s schema, indexed out of your generated decision types: createClient<EdgeKitDecisions['site_example']>({ siteId: 'site_example' }).

Index the site; do not pass the whole EdgeKitDecisions type. TypeScript has no partial type-argument inference, so createClient<EdgeKitDecisions> loses the 'site_example' literal and keeps only the features every site runs, which is often none. With the site as the type argument, calling a feature on a site that does not run it is a compile error.

S extends SiteSchema

optional baseUrl?: string

Absolute URL of your tenant host, for a page that cannot proxy /edgekit/*. Only its origin is used.

Requests through an absolute baseUrl carry a session only when the user signed in through that host and it shares the page’s domain (edgekit.example.com for www.example.com), or the organization’s cookie domain covers both hosts. By default the session cookie is host-only and SameSite=Lax: a session started on the page’s own host is not sent to the tenant host, and a tenant host on another domain never gets one. Without a session decide still answers 200, as for an anonymous device, with no error; calls that need a session are refused. Leave baseUrl unset to use the relative /edgekit/* path on your own domain, which always identifies the user.


siteId: S["id"]

The site this client serves. Must equal S['id']. Create one client per site.


optional timeoutMs?: number

How long decide waits, in milliseconds, before its features answer unavailable. Default 2000. No other call has a timeout; pass a signal to cancel one.