Socket
Socket
Sign inDemoInstall

launchdarkly-js-sdk-common

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

launchdarkly-js-sdk-common

LaunchDarkly SDK for JavaScript - common code


Version published
Weekly downloads
1.1M
decreased by-0.14%
Maintainers
1
Weekly downloads
 
Created

What is launchdarkly-js-sdk-common?

The launchdarkly-js-sdk-common package is a JavaScript SDK for LaunchDarkly, a feature management platform that allows developers to control the release of features to users. This SDK provides the core functionality for interacting with LaunchDarkly's feature flagging and experimentation capabilities.

What are launchdarkly-js-sdk-common's main functionalities?

Initialize the SDK

This feature allows you to initialize the LaunchDarkly client with your environment key and user information. The client can then be used to interact with LaunchDarkly's feature flags.

const { initialize } = require('launchdarkly-js-sdk-common');
const client = initialize('YOUR_ENVIRONMENT_KEY', { key: 'user_key' });

Evaluate Feature Flags

Once the client is ready, you can evaluate feature flags using the `variation` method. This method takes the feature flag key and a default value, returning the flag's value for the user.

client.on('ready', () => {
  const showFeature = client.variation('your-feature-flag-key', false);
  console.log('Feature flag value:', showFeature);
});

Track Custom Events

This feature allows you to track custom events in LaunchDarkly. You can send event data that can be used for analytics and experimentation purposes.

client.track('custom-event-key', { customData: 'value' });

Close the Client

This feature allows you to close the LaunchDarkly client, ensuring that all pending events are sent before the application exits.

client.close();

Other packages similar to launchdarkly-js-sdk-common

FAQs

Package last updated on 01 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc