@seobryn/local-flags
v1.1.3
Published
Client feature flags management
Downloads
25
Maintainers
Readme
Local Flags
This tool helps you to manage feature flags locally in the browser. It use vanilla javascript to manage feature flags, so you can use it in any web application.
Install
# Using npm
npm install @seobryn/local-flags
# Using pnpm
pnpm i @seobryn/local-flags
or if you want to add it through the CDN:
import { setupLocalFlags } from "https://cdn.jsdelivr.net/npm/@seobryn/local-flags@latest/index.mjs"
import { setupLocalFlags } from "https://unpkg.com/@seobryn/[email protected]/index.mjs"
Usage
// in your main js file
import { setupLocalFlags } from '@seobryn/local-flags';
setupLocalFlags(); // use this to setup local flags.
setupLocalFlags({
calendarView: false
}); // use this to setup local flags with default values.
const localFlags = setupLocalFlags({
calendarView: false
}, { useGloblal:false }) // use this setup if you want to expose localFlags Object in your JS code without using the global variable.
// in your application or in the browser console
localFlags.enableFeature('calendarView'); // use this to enable a feature.
localFlags.disableFeature('calendarView'); // use this to disable a feature.
localFlags.featureList(); // use this to list all features.
localFlags.isFeatureEnabled('calendarView'); // use this to check if a feature is enabled.
Live example
Try out the live example here