Remote Config
Remote Config in the JavaScript SDK.
// access
nexus.remoteConfig| Symbol | Kind | Summary |
|---|---|---|
NexusRemoteConfig | class | Firebase-style Remote Config: typed parameters with server-evaluated conditions (platform, version, country, percentile, custom attributes). |
REMOTE_CONFIG_ROOM | constant |
NexusRemoteConfig
classFirebase-style Remote Config: typed parameters with server-evaluated conditions (platform, version, country, percentile, custom attributes).
NexusRemoteConfig
constructornew NexusRemoteConfig(http: NexusHttp, id: NexusIdentity, cfg: ResolvedConfig)Parameters
Prop
Type
Returns NexusRemoteConfig
version
propertyreadonly version: numberlastFetchTime
propertyreadonly lastFetchTime: Date | nullsetDefaults()
methodsetDefaults(defaults: Record<string, unknown>): voidIn-app fallback values, used until/unless the server has a value.
Parameters
Prop
Type
setAttributes()
methodsetAttributes(attributes: Record<string, unknown>): voidPersistent custom targeting attributes sent with every fetch.
Parameters
Prop
Type
setAttribute()
methodsetAttribute(key: string, value: unknown): voidParameters
Prop
Type
clearAttributes()
methodclearAttributes(): voidonChange()
methodonChange(listener: ChangeListener): () => voidSubscribe to config changes. Returns an unsubscribe function.
Parameters
Prop
Type
Returns () => void
fetch()
methodasync fetch(attributes?: Record<string, unknown>): Promise<boolean>Fetch + activate the published template. Returns true if values changed.
Parameters
Prop
Type
Returns Promise<boolean>
getValue()
methodgetValue(key: string): unknownParameters
Prop
Type
Returns unknown
getString()
methodgetString(key: string, fallback: string = ''): stringParameters
Prop
Type
Returns string
getBool()
methodgetBool(key: string, fallback: boolean = false): booleanParameters
Prop
Type
Returns boolean
getNumber()
methodgetNumber(key: string, fallback: number = 0): numberParameters
Prop
Type
Returns number
getJSON()
methodgetJSON<T = unknown>(key: string, fallback?: T): TParameters
Prop
Type
Returns T
sourceOf()
methodsourceOf(key: string): string | nullParameters
Prop
Type
Returns string | null
getAll()
methodgetAll(): Record<string, unknown>Returns Record<string, unknown>
subscribeRealtime()
methodasync subscribeRealtime(realtime: NexusRealtime): Promise<void>Re-fetch automatically when a new template is published (needs realtime).
Parameters
Prop
Type
Functions
REMOTE_CONFIG_ROOM
constantconst REMOTE_CONFIG_ROOM: "__remote_config"