Utilities
Utilities in the JavaScript SDK.
import { NexusLog, isBrowser } from '@inverge/nexus'| Symbol | Kind | Summary |
|---|---|---|
NexusLog | class | Minimal leveled logger; never throws. |
NexusService | type | Per-service on/off switches — turn a Nexus product off without removing the code that uses it. |
isBrowser | constant | Runtime environment detection (isomorphic — browser vs Node). |
isNode | constant | |
platformName() | function | Best-effort platform label for targeting/telemetry. |
SERVICE_ENV | constant | Service → the environment variable that switches it. |
NexusLog
classMinimal leveled logger; never throws.
configure()
static methodstatic configure(level: Level): voidParameters
Prop
Type
debug()
static methodstatic debug(msg: string): voidParameters
Prop
Type
info()
static methodstatic info(msg: string): voidParameters
Prop
Type
warn()
static methodstatic warn(msg: string): voidParameters
Prop
Type
error()
static methodstatic error(msg: string, err?: unknown): voidParameters
Prop
Type
mask()
static methodstatic mask(key: string): stringParameters
Prop
Type
Returns string
NexusService
typeexport 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
constantconst isBrowser: booleanRuntime environment detection (isomorphic — browser vs Node).
isNode
constantconst isNode: booleanplatformName()
functionplatformName(): stringBest-effort platform label for targeting/telemetry.
Returns string
SERVICE_ENV
constantconst SERVICE_ENV: Readonly<Record<NexusService, string>>Service → the environment variable that switches it.
