1.0.3 • Published 2 years ago

ts-feature-flags v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

FEATURE FLAGS

We use this system to define features that we can easily turn on and off, for testing or to put something temporarily on hold.

To define one, add it to the defaults object. The value must be a boolean.

Use it in TypeScript code:

import features from "ts-feature-flags";

function foo() {
if (features.enabled("bar")) {
    doSomething();
 }
}

Use it in TSX:

<div>
 {features.enabled("bar") && <Something />}
</div>

Use it in JavaScript code:

import features from "ts-feature-flags";

function foo() {
if (features.bar)) {
    doSomething();
 }
}

To set or unset them, open devtools, and:

features.foo = true;
features.bar = false;
features.unset('piyo'); // resets to default

Then you have to reload the page or restart the app. Intentionally the values are not changed on the fly, to avoid bugs with IPC, React update headaches, etc.

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago