@leisurelink/feature-flag-client

1.1.3 • Public • Published

feature-flag-client

constructor

similar to any other trusted client

var featureFlagClient = new FeatureFlagClient(config.featureFlagUri, config.trustedId, config.trustedKey, console);

caching subscriber

the new preferred method to check flags is to use our caching subscriber... which will keep a local cache of flags that you can synchronously query:

var subscriber = featureFlagClient.getStreamSubscriber();

if (subscriber.getFlagValue('api.feature1')) {
	// feature1 is enabled!
} else {
	// no feature1 for you!
}

// or...
var flag = subscriber.getFlag('api.feature1');
if (flag && flag.value) {
	// feature1 is enabled!
}

subscription events

if by chance you need events, you can:

// subscribe to a specific flag
subscriber.onFlagId('api.feature', function(flag) {
	if (flag.deleted) {
		// flag deleted!
	} else {
		if (flag.value) {
			// flag is set!
		}
	}
});

// or subscribe to all flags
subscriber.onFlag(function(flag) {
	console.log(flag);
});

the CRUD methods

see the index.js for all the standard CRUD methods or check out the CLI

Readme

Keywords

none

Package Sidebar

Install

npm i @leisurelink/feature-flag-client

Weekly Downloads

0

Version

1.1.3

License

ISC

Last publish

Collaborators

  • uniqname
  • blake1321
  • jouellette
  • lhirschi
  • flitbit
  • jtowner
  • twindagger
  • leisurelink-robot