Skip to content

UserAgent

UserAgent is a light-weight service providing access to the user agent. It can help you do detect the browser, its version, the operating system, its version and the device type as well as help you building responsive UIs.

Classes

UserAgent

Defined in: user-agent.service.ts:13

UserAgent provides functionality related to the user-agent.

Example

// Check whether the viewport is considered a desktop
const { isDesktop } = UserAgent;
// You may also customize UserAgent's behavior
UserAgent.setOptions({ desktopBreakpoint: 1200 });

Extends

  • any

Constructors

new UserAgent()

new UserAgent(): UserAgent

Returns

UserAgent

Inherited from

ServiceMixin<UserAgent>().constructor

Accessors

isDesktop
Get Signature

get static isDesktop(): boolean

Defined in: user-agent.service.ts:39

Whether the current viewport is considered a desktop.

Returns

boolean

Whether the current viewport is considered a desktop.

options
Get Signature

get static options(): UserAgentOptions

Defined in: user-agent.service.ts:31

Gets the UserAgents options.

Returns

UserAgentOptions

The UserAgents options.

Methods

setOptions()

static setOptions(options): void

Defined in: user-agent.service.ts:23

Sets the UserAgents options.

Parameters
options

Partial<UserAgentOptions>

The options to use.

Returns

void

After the options have been set.

Interfaces

UserAgentOptions

Defined in: types.ts:4

The options for the UserAgent service.

Properties

desktopBreakpoint

desktopBreakpoint: number

Defined in: types.ts:10

The minimum viewport width in pixels that will be considered a desktop device. Defaults to 960 pixels.

Default
960;