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 towindow?.GLOBAL_CONFIG?.debug ?? falsetimeout: load timeout in milliseconds, default10000resourceUrl: defaults tohttps://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:
userAgentisIOSisAndroidisDZAppisDZAppByDS
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:
cvaclsxtwMerge