How to use the launchdarkly-js-sdk-common.initialize function in launchdarkly-js-sdk-common

To help you get started, we’ve selected a few launchdarkly-js-sdk-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github launchdarkly / js-client-sdk / src / index.js View on Github external
export function initialize(env, user, options = {}) {
  const platform = browserPlatform(options);
  const clientVars = common.initialize(env, user, options, platform, extraOptionDefs);

  const client = clientVars.client;
  const validatedOptions = clientVars.options;
  const emitter = clientVars.emitter;

  const goalsPromise = new Promise(resolve => {
    const onGoals = emitter.on(goalsEvent, () => {
      emitter.off(goalsEvent, onGoals);
      resolve();
    });
  });
  client.waitUntilGoalsReady = () => goalsPromise;

  if (validatedOptions.fetchGoals) {
    const goalManager = GoalManager(clientVars, () => emitter.emit(goalsEvent));
    platform.customEventFilter = goalManager.goalKeyExists;

launchdarkly-js-sdk-common

LaunchDarkly SDK for JavaScript - common code

Apache-2.0
Latest version published 17 days ago

Package Health Score

83 / 100
Full package analysis