Skip to main content

Overview

Feature flags let you enable or disable features in your overlay without deploying a new version. Flags are managed through the Overlayed Dashboard and automatically fetched by @overlayed/app.

Registering Flags

Pass a record of flag names and their default values to the featureFlags option. The keys provide typed access, and the values are used as defaults before the API responds or when a flag is missing from the response.
If a registered flag name is not found in the API response, a warning is logged to help catch typos or removed flags.

Waiting for Flags

The ready promise resolves once the initial feature flag fetch completes, whether it succeeds or fails. Use it to delay app startup until flags are available.

Checking Flag Status

Before the API responds, or if the flag is missing from the response, get returns the configured default value. If no default was registered, it returns false. Get all flags at once:
getAll merges defaults, API values, and overrides — API values take precedence over defaults, and overrides take precedence over both.

Listening for Changes

Feature flags are automatically fetched:
  • When the overlay bootstraps
  • Every 10 minutes
  • When a game launches or closes
Listen for individual flag changes:
Listen for any flag update:

Manual Refresh

Force a refresh from the API at any time:

Overriding Flags

Override flag values locally. Overrides persist across API refetches and take precedence over API values. Override a single flag:
Calling override emits a change event for the flag (and the updated event) if the effective value changes. Once overridden, subsequent API refreshes will not emit change events for that flag.
Check whether a flag is overridden:
Get every active override:

Clearing Overrides

Remove an override so the flag resolves from the API value (or default) again:
Remove every override at once:
Clearing an override emits a change event for the flag (and the updated event) only if the effective value actually changes. Clearing an override that matched the underlying API value is silent.

Inspecting a Flag

Get a breakdown of the individual layers that contribute to a flag’s effective value. Useful for debug panels that need to show where a value came from.
Each layer is undefined when it is not set, so override: false can be distinguished from “not overridden”.