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 desktopconst { isDesktop } = UserAgent;
// You may also customize UserAgent's behaviorUserAgent.setOptions({ desktopBreakpoint: 1200 });
Extends
any
Constructors
new UserAgent()
new UserAgent():
UserAgent
Returns
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 UserAgent
s options.
Returns
The UserAgent
s options.
Methods
setOptions()
static
setOptions(options
):void
Defined in: user-agent.service.ts:23
Sets the UserAgent
s 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;