@pbs/vanna
v0.5.0
Published
Feature flagging service client
Downloads
1
Readme
Vanna Javascript (Browser) Client
Introduction
Vanna is an internal feature flagging service used at PBS. It helps deliver new features to users quickly and safely. This is an example client implementation for browser based Javascript.
To learn more about the rationale behind using feature flags, read these articles:
- https://martinfowler.com/articles/feature-toggles.html
- https://blog.travis-ci.com/2014-03-04-use-feature-flags-to-ship-changes-with-confidence/
Install
The recommended way to install vanna is through npm
.
npm install @pbs/vanna
Setup
After installing vanna
, you can import it with your Javascript bundler of
choice and setup the client.
import { VannaClient } from "@pbs/vanna";
const client = VannaClient({
uri: "https://vanna.example.com/project",
userSegment: "beta-tester",
fallbacks: {
"your-feature-slug": false
}
});
client.on("ready", () => {
const isFeatureEnabled = client.variation("your-feature-slug", {
fallback: false
});
if (isFeatureEnabled) {
// Do something if feature is enabled
} else {
// Do another thing if feature is disabled
}
});