SDKs
Browser SDK
You can use the same Featurevisor JavaScript SDK in browser environments as well.
Installation#
Install with npm:
$ npm install --save @featurevisor/sdkAPI#
Please find the full API docs in JavaScript SDK page.
OpenFeature#
Use Featurevisor through the OpenFeature Web SDK with the browser provider:
$ npm install --save @featurevisor/openfeature-provider-web @openfeature/web-sdkimport { OpenFeature } from '@openfeature/web-sdk'import { FeaturevisorOpenFeatureProvider } from '@featurevisor/openfeature-provider-web'const provider = new FeaturevisorOpenFeatureProvider({ datafile,})await OpenFeature.setProviderAndWait(provider)await OpenFeature.setContext({ targetingKey: 'user-123' })const client = OpenFeature.getClient()const enabled = client.getBooleanValue('checkout', false)Reusing an existing Featurevisor instance#
If your application already owns a Featurevisor instance, pass it with the featurevisor option:
import { OpenFeature } from '@openfeature/web-sdk'import { createFeaturevisor } from '@featurevisor/sdk'import { FeaturevisorOpenFeatureProvider } from '@featurevisor/openfeature-provider-web'const featurevisor = createFeaturevisor({ datafile })const provider = new FeaturevisorOpenFeatureProvider({ featurevisor })await OpenFeature.setProviderAndWait(provider)The exact instance is also available as provider.featurevisor. Evaluations, datafile updates, modules, diagnostics, and events continue to use that instance.
Your application owns an instance passed this way. Provider shutdown does not close it, so other consumers can continue using it. Call featurevisor.close() when every consumer is finished. An instance created from provider options is owned and closed by the provider.
If featurevisor and Featurevisor construction options such as datafile or modules are supplied together, the existing instance takes precedence and the construction options are ignored. Provider options such as targetingKeyField, keySeparator, variationKey, and onTrack still apply.
See the OpenFeature provider guide for key conventions, variables, variations, errors, and providers for other languages.
Browser support#
The SDK avoids newer browser-only APIs in its runtime hot path and is designed to work in older browsers without requiring additional polyfills for its own code.

