JavaScript vanilla
This library can be used with pure JavaScript, React (and all other popular frameworks/libraries).
Usage
initialize the client and get the flags
Configuration
When initializing the client, you can pass the following options:
| Prop | Type | Default |
|---|---|---|
environment | string | - |
identity? | string | - |
defaultFlags? | Record<string, boolean> | {} |
onChange? | function | - |
defaultFlags
You can pass default flags when initializing the client. These flags will be used until the client receives the flags from the server.
onChange
You can pass a callback function that will be called when the flags are updated.
Methods
getFlags
Get all flags from the client. This dont trigger a request to the server.
onChange
On change occurs when the flags are updated. This is useful when you want to execute something based on the flags. This can be triggered by a change from cached flags or a change from the server.