Flags
The ScaleBun.flags namespace — 1 members.
import ScaleBun from '@scalebun/react-native';
ScaleBun.flags.<method>(…);Members#
| Member | Signature |
|---|---|
isEnabled | isEnabled(key: string) |
Reference#
isEnabled#
ScaleBun.flags.isEnabled(key: string)Notes#
flags.isEnabled(key) is the whole namespace, and that narrowness is the point: a feature flag is a
boolean question with a boolean answer.
It resolves locally, from delivered configuration#
isEnabled does not make a network call. Flag values arrive with the SDK's configuration payload and
are evaluated on the device, which is what makes the call cheap enough to put in a render path.
The consequence is a propagation delay: flipping a flag in the dashboard reaches a device when that device next receives configuration, not instantly.
Ordering#
Before init(), the flag is not enabled
There is no configuration yet, so
isEnabledcannot return true. Treat pre-init as "off" and do not gate startup-critical behaviour on a flag.Read at the point of use, not at launch
Reading on every check is the intended usage and is what lets a mid-session flip take effect.
Default to the safe branch
Write your code so that "not enabled" is the behaviour you would ship if the flag service vanished.
Limits and edge cases#
An unknown key is not enabled. A typo silently disables the feature rather than erroring, so check the key against the dashboard rather than trusting the call.
Boolean only. For a value rather than a switch use
config; for percentage rollouts userollouts; for variant assignment useexperiments.Client-side evaluation means the flag and its value are visible to anyone inspecting the app. Never use a flag to hide something that must stay secret.
Remove flags after rollout. Each permanent flag is a branch nobody tests.