Skip to content

Instantly share code, notes, and snippets.

@ignamiguel
Last active September 5, 2018 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ignamiguel/af100579bab2cb18a6413e59b4243882 to your computer and use it in GitHub Desktop.
Save ignamiguel/af100579bab2cb18a6413e59b4243882 to your computer and use it in GitHub Desktop.
var LaunchDarkly = require('ldclient-node');
const SDK_KEY = 'Add your SDK KEY here';
const FEATRUE_KEY = 'show-new-navbar';
const ldclient = LaunchDarkly.init(SDK_KEY);
const user1 = {"key": "user-one"};
const user2 = {"key": "user-two"};
const checkFeature = function(user) {
console.log(`Checking feature "${FEATRUE_KEY}" for user key "${user.key}"`)
ldclient.variation(FEATRUE_KEY, user, false,
function(err, showFeature) {
if (showFeature) {
console.log('Yeah! showFeature is', showFeature);
} else {
console.log('Nop! showFeature is', showFeature);
}
});
};
const start = () => {
ldclient.once('ready', function() {
checkFeature(user1);
checkFeature(user2);
});
};
start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment