InvergeDocs
JavaScriptAPI reference

Remote Config

Remote Config in the JavaScript SDK.

// access
nexus.remoteConfig
SymbolKindSummary
NexusRemoteConfigclassFirebase-style Remote Config: typed parameters with server-evaluated conditions (platform, version, country, percentile, custom attributes).
REMOTE_CONFIG_ROOMconstant

NexusRemoteConfig

class

Firebase-style Remote Config: typed parameters with server-evaluated conditions (platform, version, country, percentile, custom attributes).

NexusRemoteConfig

constructor
new NexusRemoteConfig(http: NexusHttp, id: NexusIdentity, cfg: ResolvedConfig)

Parameters

Prop

Type

Returns NexusRemoteConfig

View source

version

property
readonly version: number

lastFetchTime

property
readonly lastFetchTime: Date | null

setDefaults()

method
setDefaults(defaults: Record<string, unknown>): void

In-app fallback values, used until/unless the server has a value.

Parameters

Prop

Type

View source

setAttributes()

method
setAttributes(attributes: Record<string, unknown>): void

Persistent custom targeting attributes sent with every fetch.

Parameters

Prop

Type

View source

setAttribute()

method
setAttribute(key: string, value: unknown): void

Parameters

Prop

Type

View source

clearAttributes()

method
clearAttributes(): void
View source

onChange()

method
onChange(listener: ChangeListener): () => void

Subscribe to config changes. Returns an unsubscribe function.

Parameters

Prop

Type

Returns () => void

View source

fetch()

method
async fetch(attributes?: Record<string, unknown>): Promise<boolean>

Fetch + activate the published template. Returns true if values changed.

Parameters

Prop

Type

Returns Promise<boolean>

View source

getValue()

method
getValue(key: string): unknown

Parameters

Prop

Type

Returns unknown

View source

getString()

method
getString(key: string, fallback: string = ''): string

Parameters

Prop

Type

Returns string

View source

getBool()

method
getBool(key: string, fallback: boolean = false): boolean

Parameters

Prop

Type

Returns boolean

View source

getNumber()

method
getNumber(key: string, fallback: number = 0): number

Parameters

Prop

Type

Returns number

View source

getJSON()

method
getJSON<T = unknown>(key: string, fallback?: T): T

Parameters

Prop

Type

Returns T

View source

sourceOf()

method
sourceOf(key: string): string | null

Parameters

Prop

Type

Returns string | null

View source

getAll()

method
getAll(): Record<string, unknown>

Returns Record<string, unknown>

View source

subscribeRealtime()

method
async subscribeRealtime(realtime: NexusRealtime): Promise<void>

Re-fetch automatically when a new template is published (needs realtime).

Parameters

Prop

Type

View source

Functions

REMOTE_CONFIG_ROOM

constant
const REMOTE_CONFIG_ROOM: "__remote_config"

On this page