Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

launchdarkly-js-client-sdk

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

launchdarkly-js-client-sdk

LaunchDarkly SDK for JavaScript

  • 3.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
855K
decreased by-16.67%
Maintainers
1
Weekly downloads
 
Created

What is launchdarkly-js-client-sdk?

The launchdarkly-js-client-sdk is a JavaScript SDK for LaunchDarkly, a feature management platform that allows developers to control the release of features to users. This SDK enables you to manage feature flags, perform A/B testing, and roll out new features gradually.

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

Initialize the client

This code initializes the LaunchDarkly client with your environment key and a user object. The client is ready to be used once the 'ready' event is fired.

const LDClient = require('launchdarkly-js-client-sdk');
const client = LDClient.initialize('YOUR_ENVIRONMENT_KEY', { key: 'user_key' });
client.on('ready', () => {
  console.log('LaunchDarkly client is ready');
});

Evaluate feature flags

This code evaluates a feature flag and returns its value. If the feature flag is enabled, it will log 'Feature is enabled'; otherwise, it will log 'Feature is disabled'.

client.on('ready', () => {
  const showFeature = client.variation('your-feature-flag-key', false);
  if (showFeature) {
    console.log('Feature is enabled');
  } else {
    console.log('Feature is disabled');
  }
});

Track custom events

This code tracks a custom event with a specified key and optional data. This can be useful for analytics and monitoring user interactions.

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

Identify users

This code identifies a new user with a unique key and optional attributes. This is useful for targeting specific users with feature flags.

client.identify({ key: 'new_user_key', name: 'New User' }).then(() => {
  console.log('User identified');
});

Other packages similar to launchdarkly-js-client-sdk

Keywords

FAQs

Package last updated on 18 Oct 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