LaunchDarkly Adapter
TheLaunchDarklyFeatureAdapter integrates LaunchDarkly feature flags with Vuetify Zero’s useFeatures composable.
Import
Installation
Install the LaunchDarkly SDK as a peer dependency:Basic Usage
With User Context
Using in Components
Feature Flags
Boolean Flags
Multivariate Flags
JSON Flags
Change Detection
The adapter automatically syncs when flags change:Updating User Context
Flag Value Types
LaunchDarkly flags are transformed based on their value type:Multiple Environments
Offline Mode
TypeScript
Cleanup
The adapter automatically unsubscribes from flag changes when the app unmounts:Multiple Adapters
API Reference
Constructor
Parameters
| Parameter | Type | Description |
|---|---|---|
client | LDClient | LaunchDarkly client instance |
Methods
| Method | Description |
|---|---|
setup(onUpdate) | Initialize adapter and register change handler |
dispose() | Unsubscribe from flag changes |
Flag Structure
Best Practices
- Always await
waitUntilReady()before creating the adapter to ensure initial flags are loaded - Use variations for A/B tests - Access them with
features.variation(key, fallback) - Watch flag changes - React to real-time updates with
watch(features.selectedIds, ...) - Provide fallbacks - Always specify fallback values for
variation()calls
See Also
- Flagsmith Adapter - Flagsmith integration
- PostHog Adapter - PostHog feature flags
- useFeatures - Feature flags composable
- LaunchDarkly Documentation - Official LaunchDarkly docs