Skip to main content
Version: 4.0 (Current)

Browser

@dz-web/esboot-browser is the browser-side utility package for ESBoot.

Installation

pnpm install @dz-web/esboot-browser

AOP

createExternalConsole

Creates an external console for environments where the native browser console is not enough. The default implementation uses eruda.

interface CreateExternalConsoleOptions {
enabled?: boolean;
timeout?: number;
resourceUrl?: string;
}

Common options:

  • enabled: defaults to window?.GLOBAL_CONFIG?.debug ?? false
  • timeout: load timeout in milliseconds, default 10000
  • resourceUrl: defaults to https://cdn.jsdelivr.net/npm/eruda

Utils

flattenLangObject

Flattens nested translation JSON for use with react-intl message maps.

{
"a": 1,
"b": { "c": 2 }
}

becomes:

{
"a": 1,
"b.c": 2
}

Constants

The package exports common browser-related constants such as:

  • userAgent
  • isIOS
  • isAndroid
  • isDZApp
  • isDZAppByDS

Style Helpers

cn

A combined helper built from clsx and twMerge, similar to the cn helper popularized by shadcn/ui.

Style Libs

The package also re-exports utilities such as:

  • cva
  • clsx
  • twMerge