Registration
provideNexus(app, config): Promise<NexusClient>
Creates the client, registers it on the application, opens the live stream, and
wraps app.unmount so the client is closed on teardown. await it before
app.mount().
Throws NexusConfigError for an invalid option and NexusInitError if the first
sync fails.
createNexusPlugin(config): Plugin
The app.use() form. Registers its handle synchronously during install(),
so every component resolves it - including one that mounts before the initial
sync finishes. Value composables return their defaults until the client lands,
then update reactively.
An initialisation failure is not thrown; it is exposed through useNexusError().
Value composables
Each returns aComputedRef. They register no listener of their own, so they are
safe to call from a store, from module scope, or after the first await in an
async setup().
state is one of idle, connecting, connected, reconnecting, polling.
Readiness
Actions
useNexus(): NexusClient
The client itself. Throws when the SDK is not registered on the application, and
- on the plugin path - while the initial sync is still running. Gate on
useNexusReady(), or read values through the composables, which handle the not-ready state themselves.
useNexusSync(): () => Promise<void>
Refreshes the cache. Concurrent calls share one request. Resolves without doing
anything while the client is still initialising.
useEvaluateAB(): (keys, userId, attributes?: Record<string, string>) => Promise<Record<string, boolean>>
Evaluates flags through the AB Testing endpoint. Always a live call. Rejects
while the client is not ready, and with NexusAbAddonNotAvailableError when the
add-on is not active.
NEXUS_HANDLE
The injection key for the handle the SDK provides:
NexusClient
Types and constants
NexusConfig, NexusHandle, NexusStreamStatus, NexusLogger,
NexusLogFields, NexusStreamObserver, NexusStreamState,
NexusChangeListener, PublicApiKey.
assertPublicKey(key) narrows a string to PublicApiKey, throwing if it is not
a public key - the same check the client applies to apiKey.
NOOP_LOGGER, NOOP_STREAM_OBSERVER, FALLBACK_REASON_MAX_ERRORS,
FALLBACK_REASON_RATE_LIMITED, FALLBACK_REASON_TRANSPORT.
