-
-
Save ignamiguel/af100579bab2cb18a6413e59b4243882 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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