Sign up (with export icon)

utils/env

Api-module icon module

Constants

Interfaces

Functions

  • Chevron-right icon

    getUserAgent() → string
    internal

    Safely returns userAgent from browser's navigator API in a lower case. If navigator API is not available it will return an empty string.

    Returns

    string
  • Chevron-right icon

    isAndroid( userAgent ) → boolean
    internal

    Checks if User Agent represented by the string is Android mobile device.

    Parameters

    userAgent : string

    Lowercase navigator.userAgent string.

    Returns

    boolean

    Whether User Agent is Safari or not.

  • Checks if User Agent represented by the string is Blink engine.

    Parameters

    userAgent : string

    Lowercase navigator.userAgent string.

    Returns

    boolean

    Whether User Agent is Blink engine or not.

  • Chevron-right icon

    isGecko( userAgent ) → boolean
    internal

    Checks if User Agent represented by the string is Firefox (Gecko).

    Parameters

    userAgent : string

    Lowercase navigator.userAgent string.

    Returns

    boolean

    Whether User Agent is Firefox or not.

  • Chevron-right icon

    isMac( userAgent ) → boolean
    internal

    Checks if User Agent represented by the string is running on Macintosh.

    Parameters

    userAgent : string

    Lowercase navigator.userAgent string.

    Returns

    boolean

    Whether User Agent is running on Macintosh or not.

  • Chevron-right icon

    isMediaForcedColors() → boolean
    internal

    Checks if the user agent has enabled a forced colors mode (e.g. Windows High Contrast mode).

    Returns false in environments where window global object is not available.

    Returns

    boolean
  • Chevron-right icon

    isMotionReduced() → boolean
    internal

    Checks if the user enabled "prefers reduced motion" setting in browser.

    Returns false in environments where window global object is not available.

    Returns

    boolean
  • Chevron-right icon

    isRegExpUnicodePropertySupported() → boolean
    internal

    Checks if the current environment supports ES2018 Unicode properties like \p{P} or \p{L}. More information about unicode properties might be found in Unicode Standard Annex #44.

    Returns

    boolean
  • Chevron-right icon

    isSafari( userAgent ) → boolean
    internal

    Checks if User Agent represented by the string is Safari.

    Parameters

    userAgent : string

    Lowercase navigator.userAgent string.

    Returns

    boolean

    Whether User Agent is Safari or not.

  • Chevron-right icon

    isWindows( userAgent ) → boolean
    internal

    Checks if User Agent represented by the string is running on Windows.

    Parameters

    userAgent : string

    Lowercase navigator.userAgent string.

    Returns

    boolean

    Whether User Agent is running on Windows or not.

  • Chevron-right icon

    isiOS( userAgent ) → boolean
    internal

    Checks if User Agent represented by the string is running in iOS.

    Parameters

    userAgent : string

    Lowercase navigator.userAgent string.

    Returns

    boolean

    Whether User Agent is running in iOS or not.