
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
@harnessio/ff-javascript-client-sdk
Advanced tools
Basic library for integrating CF into javascript applications.
Library for integrating Harness Feature Flags 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.
initialize(FeatureFlagSDKKey: string, target: Target, options?: Options)
In which Target
and Options
are defined as:
interface Target {
identifier: string
name?: string
anonymous?: boolean
attributes?: object
}
interface Options {
baseUrl?: string
debug?: boolean
}
For example:
const cf = initialize('00000000-1111-2222-3333-444444444444', {
identifier: YOUR-TARGET-IDENTIFIER, // Target identifier
name: YOUR-TARGET-NAME, // Optional target name
attributes: { // Optional target attributes
email: 'sample@sample.com'
}
}, {
baseURL: HARNESS-FEATURE-FLAG-BASE-URL, // Optional Harness Feature Flag server base URL
});
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) // second argument is default value when variation does not exist
Remove a listener of an event by cf.off
.
cf.off(Event.ERROR, () => {
// Do something when an error occurs
})
Remove all listeners:
cf.off()
On closing your application, call cf.close()
to close the event 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 11,995 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 11 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.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.