Options
All
  • Public
  • Public/Protected
  • All
Menu

LaunchDarkly Vue SDK (1.0.0)

Index

Type aliases

LDPluginOptions: { clientSideID?: string; deferInitialization?: boolean; options?: LDOptions; streaming?: boolean; user?: LDUser }

Type declaration

  • Optional clientSideID?: string

    Indicates which LaunchDarkly project to use. Must be provided here or in a call to ldInit for the SDK to work.

  • Optional deferInitialization?: boolean

    Defers initialization of the LaunchDarkly client until ldInit is called explicitly.

    defaultvalue

    false

  • Optional options?: LDOptions

    Options to pass to the underlying javascript SDK.

  • Optional streaming?: boolean

    Enables or disables automatically subscribing to live updates to flags referenced using useLDFlag.

    defaultvalue

    true

  • Optional user?: LDUser

    User definition.

    defaultvalue

    Defaults to anonymous user, { anonymous: 'true' }

Variables

LDPlugin: { install: any } = ...

Vue plugin wrapper for the LaunchDarkly JavaScript SDK.

If provided with a clientSideID will initialize the LaunchDarkly client automatically (unless deferInitialization is true).

see

LDPluginOptions for configuration options

Type declaration

  • install:function
    • Parameters

      Returns void

LD_CLIENT: InjectionKey<LDClient> = ...

Injection key used to retrieve LaunchDarkly client. Usage: const ldClient = inject(LD_CLIENT). Alternatively use useLDClient.

LD_FLAG: InjectionKey<<T>(flagKey: string, defaultFlagValue?: T) => Readonly<Ref<T>>> = ...

Injection key used to retrieve ldFlag function. Usage: const ldFlag = inject(LD_FLAG). Alternatively use useLDFlag.

LD_INIT: InjectionKey<(o?: LDPluginOptions) => [Readonly<Ref<boolean>>, LDClient]> = ...

Injection key used to retreive LaunchDarkly client initialization function. Usage: const ldInit = inject(LD_INIT). Alternatively use ldInit.

LD_READY: InjectionKey<Readonly<Ref<boolean>>> = ...

Injection key used to retrieve a boolean ref indicating if the LaunchDarkly client has finished initializing. Usage: const ldReady = inject(LD_READY). Alternatively use useLDReady.

Functions

  • Initializes the LaunchDarkly client. Uses Vue's inject API, and will only work if run inside a Vue setup hook or <script setup>.

    Parameters

    Returns [Readonly<Ref<boolean>>, LDClient]

  • useLDClient(): LDClient
  • useLDFlag<T>(flagKey: string, defaultValue?: T): Readonly<Ref<T>>
  • Evaluates a single feature flag. Automatically subscribes to streamed updates unless the streaming option was set to false. Uses Vue's inject API, so will only work if run inside a Vue setup hook or <script setup>.

    Type parameters

    • T

      Type of the flag's value. Can be inferred if a default value is provided.

    Parameters

    • flagKey: string

      Key of the feature flag to be evaluated.

    • Optional defaultValue: T

      Default value to be used while flag value loads, or if flag cannot be found.

    Returns Readonly<Ref<T>>

    Readonly ref to the flag's value.

  • useLDReady(): Readonly<Ref<boolean>>
  • Indicates if the LaunchDarkly client has finished initializing. Uses Vue's inject API, and will only work if run inside a Vue setup hook or <script setup>.

    Returns Readonly<Ref<boolean>>

    Readonly boolean reference indicating if the LaunchDarkly client has finished initializing.

Generated using TypeDoc