InvergeDocs
JavaScriptAPI reference

Utilities

Utilities in the JavaScript SDK.

import { NexusLog, isBrowser } from '@inverge/nexus'
SymbolKindSummary
NexusLogclassMinimal leveled logger; never throws.
NexusServicetypePer-service on/off switches — turn a Nexus product off without removing the code that uses it.
isBrowserconstantRuntime environment detection (isomorphic — browser vs Node).
isNodeconstant
platformName()functionBest-effort platform label for targeting/telemetry.
SERVICE_ENVconstantService → the environment variable that switches it.

NexusLog

class

Minimal leveled logger; never throws.

configure()

static method
static configure(level: Level): void

Parameters

Prop

Type

View source

debug()

static method
static debug(msg: string): void

Parameters

Prop

Type

View source

info()

static method
static info(msg: string): void

Parameters

Prop

Type

View source

warn()

static method
static warn(msg: string): void

Parameters

Prop

Type

View source

error()

static method
static error(msg: string, err?: unknown): void

Parameters

Prop

Type

View source

mask()

static method
static mask(key: string): string

Parameters

Prop

Type

Returns string

View source

NexusService

type
export type NexusService = | 'realtime' | 'events' | 'errors' | 'logs' | 'sessions' | 'flags' | 'remoteConfig' | 'links' | 'surveys' | 'push' | 'inApp' | 'liveActivities' | 'replay' | 'telescope';

Per-service on/off switches — turn a Nexus product off without removing the code that uses it. A switched-off service makes no network call and never throws: writes are skipped and reads return their neutral value (flags → defaults, Remote Config → defaults, lists → empty).

Node reads the environment (all default to on):

NEXUS_ENABLED=false # everything off NEXUS_PUSH_ENABLED=false # only push off NEXUS_LIVE_ACTIVITIES_ENABLED=false # only Live Activities off

In the browser (no environment) pass services: { push: false } / enabled: false to Nexus.init. Off wins: a service is on only if neither the config nor the environment turns it off.

Functions

isBrowser

constant
const isBrowser: boolean

Runtime environment detection (isomorphic — browser vs Node).

isNode

constant
const isNode: boolean

platformName()

function
platformName(): string

Best-effort platform label for targeting/telemetry.

Returns string

View source

SERVICE_ENV

constant
const SERVICE_ENV: Readonly<Record<NexusService, string>>

Service → the environment variable that switches it.

On this page