Skip to main content

@rtorcato/browser-common / common

common

Variables

isBrowser

const isBrowser: boolean

Defined in: common/index.ts:5

Checks if the code is running in a browser environment.

Returns

True if running in a browser, false otherwise.

Functions

getUserAgent()

getUserAgent(): string | undefined

Defined in: common/index.ts:11

Returns the browser's user agent string, if available.

Returns

string | undefined

The user agent string or undefined if not in a browser.


isMobile()

isMobile(): boolean

Defined in: common/index.ts:19

Detects if the user is on a mobile device.

Returns

boolean

True if the user agent is a mobile device, false otherwise.


getBrowserLanguage()

getBrowserLanguage(): string | undefined

Defined in: common/index.ts:29

Returns the browser's preferred language, if available.

Returns

string | undefined

The preferred language or undefined if not in a browser.