FeatureHub client/browser SDK for feature flags, remote configuration, and A/B testing. This package is designed for browser environments (or any non-Node.js context) and uses Server-Sent Events (SSE) for real-time updates. Version 2.0.2 requires Node >=20.0.0 and is TypeScript-first (ships types). Key differentiators: edge-compatible, supports catch-and-release mode for local feature flag overrides during development, integrates with React SDK via featurehub-react-sdk, and offers a client-side context for multi-environment support. Releases follow a monthly cadence.
npm install featurehub-javascript-client-sdkVerified import paths — ran on the pinned version, not inferred.
Creates a FeatureHub client with a user context, starts receiving features via SSE, and checks a boolean flag after 5 seconds.
Use the builder pattern: `FeatureHubClient.newClient({...}).build()`.Use `import` syntax or dynamic `import()` for CommonJS projects.
Always call `client.start()` before reading features, or listen to the 'ready' event.
Ensure your FeatureHub environment is configured for server-side evaluation and use a server-sdk-api-key.
Switch to import syntax: `import { FeatureHubClient } from 'featurehub-javascript-client-sdk'`Use `repository.isEnabled('flag-key')` after setting up the repository on the client.Ensure you pass `apiKey` as a non-empty string to `newClient()`, e.g., `FeatureHubClient.newClient({ apiKey: '...' })`No dependency data recorded yet.