Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@harnessio/ff-javascript-client-sdk
Advanced tools
Basic library for integrating CF into javascript applications.
Basic library for integrating CF into javascript applications.
npm i @harnessio/ff-javascript-client-sdk
or
yarn add @harnessio/ff-javascript-client-sdk
import { initialize, Event } from '@harnessio/ff-javascript-client-sdk'
Initialize SDK with api key and target information.
// Replace with your SDK Key
const FF_SDK_KEY = "2c2a12a1-6599-406e-96c4-031a51c8a51b"
const cf = initialize(FF_SDK_KEY, {
identifier: YOUR-TARGET-IDENTIFIER, // Target identifier
name: YOUR-TARGET-NAME, // Optional target name
attributes: { // Optional target attributes
email: 'sample@sample.com'
}
}, {
baseUrl: 'http://40.20.100.200/api/1.0', // Replace with your Feature Flags server
});
cf
instance.cf.on(Event.READY, flags => {
// Event happens when connection to server is established
// flags contains all evaluations against SDK key
})
cf.on(Event.CHANGED, flagInfo => {
// Event happens when a changed event is pushed
// flagInfo contains information about the updated feature flag
})
cf.on(Event.DISCONNECTED, () => {
// Event happens when connection is disconnected
})
cf.on(Event.ERROR, () => {
// Event happens when connection some error has occurred
})
const value = cf.variation("dark-theme", false)
Remove a listener of an event by cf.off
.
cf.off(Event.ERROR, YOUR-CLOSURE)
Remove all listeners:
cf.off()
On closing your application, call cf.close()
to close the stream.
cf.close();
Apache version 2.
FAQs
Basic library for integrating CF into javascript applications.
The npm package @harnessio/ff-javascript-client-sdk receives a total of 6,389 weekly downloads. As such, @harnessio/ff-javascript-client-sdk popularity was classified as popular.
We found that @harnessio/ff-javascript-client-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.