Function createLDProviderWithClient

  • Creates a LaunchDarkly provider component that wraps an existing client.

    Parameters

    • client: LDVueClient

      a LaunchDarkly Vue client

    • injectionKey: InjectionKey<LDVueInstance> = LDVueInstanceKey

      optional injection key for multiple environments

    Returns DefineComponent<{}, (() => undefined | VNode<RendererNode, RendererElement, {
        [key: string]: any;
    }>[]), {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, ToResolvedProps<{}, {}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>

    Remarks

    NOTE: We recommend using createLDProvider instead of this function if you can.

    This factory is provided to allow the caller to use an existing client instance. When using this function, the caller is responsible for calling client.start() before or after mounting.

    The returned component renders its default slot. It also supports optional initializing and failed slots: when provided, they render instead of the default slot while the client is initializing or after it has failed (the failed slot receives an error prop).

    Example

    import { createClient, createLDProviderWithClient } from '@launchdarkly/vue-client-sdk';

    const client = createClient('your-client-side-id', { kind: 'user', key: 'user-key' });
    client.start();
    const LDProvider = createLDProviderWithClient(client);

    For multiple client instances, pass a custom injection key:

    const key = createLDVueInstanceKey();
    const LDProvider = createLDProviderWithClient(client, key);

    See

Generated using TypeDoc