Noncollinear Perpendicular Microcrystalline
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

configcat-js

1.1.14 • Public • Published

ConfigCat SDK for JavaScript frontend applications

ConfigCat SDK for JavaScript provides easy integration between ConfigCat service and frontend applications.

ConfigCat is a feature flag, feature toggle, and configuration management service. That lets you launch new features and change your software configuration remotely without actually (re)deploying code. ConfigCat even helps you do controlled roll-outs like canary releases and blue-green deployments. https://configcat.com

Build Status codecov Known Vulnerabilities License NPM

Getting Started

1. Install and import package:

via NPM package:

npm i configcat-js
import * as configcat from "configcat-js";

via CDN:

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/configcat-js@1.1.14/dist/configcat.min.js"></script>

2. Log in to ConfigCat Management Console and go to your Project to get your API Key:

API-KEY

3. Create a ConfigCat client instance:

var configCatClient = configcat.createClient("#YOUR-API-KEY#");

We strongly recommend using the ConfigCat Client as a Singleton object in your application.

4. Get your setting value:

configCatClient.getValue("isMyAwesomeFeatureEnabled", false, (value) => {
    if(value) {
        do_the_new_thing();
    } else {
        do_the_old_thing();
    }
});

Getting user specific setting values with Targeting

Using this feature, you will be able to get different setting values for different users in your application by passing a User Object to the getValue() function.

Read more about Targeting here.

configCatClient.getValue("isMyAwesomeFeatureEnabled", false, (value) => {
    if(value) {
        do_the_new_thing();
    } else {
        do_the_old_thing();
    }},
    { identifier : "#USER-IDENTIFIER#" }
);

Sample/Demo apps

Polling Modes

The ConfigCat SDK supports 3 different polling mechanisms to acquire the setting values from ConfigCat. After latest setting values are downloaded, they are stored in the internal cache then all requests are served from there. Read more about Polling Modes and how to use them at ConfigCat Docs.

Support

If you need help how to use this SDK feel free to to contact the ConfigCat Staff on https://configcat.com. We're happy to help.

Contributing

Contributions are welcome.

License

MIT

install

npm i configcat-js

Downloadsweekly downloads

37

version

1.1.14

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability