Module: UWA/Utils/Client

UWA/Utils/Client

Cross-Platform API for Client (Browser, WebView) interaction and features detections.

Index

Members

<static> UWA.Utils.Client.Engine :Object

Stores Engine infos.

Engine detection is entirely object-based.

Type
  • Object
Properties:
Name Type Description
ie Boolean

true if the current browser is internet explorer (any)

ie6 Boolean

true if the current browser is internet explorer 6

ie7 Boolean

true if the current browser is internet explorer 7

firefox Boolean

true if the current browser is Mozilla/Gecko

chrome Boolean

true if the current browser is Chrome/Chrommium

safari Boolean

true if the current browser is Safari/Konqueror

opera Boolean

true if the current browser is Safari/Konqueror

webkit Boolean

true if the current browser is opera

name String

The name of the engine (e.g "chrome")

version Number

The version of the engine (e.g 31)

fullVersion String

The version of the engine (e.g "31.0.1650.48")

<static> UWA.Utils.Client.Platform :Object

Stores Platform infos.

Type
  • Object
Properties:
Name Type Description
mac Boolean

true if the platform is mac

windows Boolean

true if the platform is windows

linux Boolean

true if the platform is linux

webos Boolean

true if the platform is webos

ios Boolean

true if the platform is ios (ipod/iphone/ipad)

blackberry Boolean

true if the platform is blackberry

android Boolean

true if the platform is android

ipad Boolean

true if the platform is ipad

tablet Boolean

true if the platform is tablet

other Boolean

true if the platform is neither mac, windows or linux

name String

Is set to the name of the platform (e.g "linux")

<static> UWA.Utils.Client.Features :Object

Stores Platform/Engine extras features infos.

Detect Platform/Engine/DOM features support, like XHR and XPath for example.

Type
  • Object
Properties:
Name Type Description
window Boolean

true if support window global

document Boolean

trueif support document global

navigator Boolean

true if support navigator global

xpath Boolean

true if support xpath

json Boolean

true if support Native JSON

orientation Boolean

true if support orientation events

querySelector Boolean

true if support querySelector

fullscreen Boolean

true if support the fullscreen API

inputPlaceholder Boolean

true if input elements supports placeholders

touchEvents Boolean

true if support touch events

pointerEvents Boolean

true if support pointer events

mutationEvents Boolean

true if support DOM MutationEvents

eventCapture Boolean

true if support event capture

transitionsCSS Boolean

true if support CSS3 Transitions

opacityCSS Boolean

true if support CSS opacity property

flexboxCSS Boolean

true if support CSS Flexbox layout (last specification)

filterCSS Boolean

true if support CSS MsFilter or CSS3 filter property

matrixCSS Boolean

true if support WebKitCSSMatrix

stickyCSS Boolean

true if support position sticky

dragAndDrop Boolean

true if support mousemove/mousedown/mouseup

<static> UWA.Utils.Client.Locale :Object

Stores Platform/Engine language, locale and dir infos.

Type
  • Object
Properties:
Name Type Description
lang String

Language value (e.g. fr_FR)

locale String

Locale value (e.g. fr)

dir String

Language direction rtl or ltr

Methods

<static> UWA.Utils.Client.getOrientation() → {String}

Get Client viewport orientation.

Return "portrait" when screen resolution is greater horizontally than vertically, and "landscape" when screen resolution is greater vertically than horizontally.

Returns

"portrait" or "landscape".

Type
String

<static> UWA.Utils.Client.getScrollbarWidth() → {Number}

Obtain the native scrollbar width.

Returns

Native width of the scrollbar.

Type
Number

<static> UWA.Utils.Client.getVendorProperty(object, template, returnName) → {String|Object}

Helper to retrieve a prefixed vendor property.

For style names, please prefer Element#getStyleName Please cache the result of this function locally in order to improve performances

Example
var cancelAnimationFrame = UWA.Client.getVendorProperty(window, 'cancelAnimationFrame');

// Is the equivalent of:
var cancelAnimationFrame = window.cancelAnimationFrame ||
   window.webkitCancelRequestAnimationFrame ||
   window.mozCancelRequestAnimationFrame ||
   window.oCancelRequestAnimationFrame ||
   window.msCancelRequestAnimationFrame ||
     // ....

var eventName = UWA.Client.getVendorProperty(document.documentElement, 'on{}fullscreenchange');
Parameters
Name Type Description
object Object

Where to search for the property

template String

The base property name. Usually, it should be the standard property name. If this string contains "{}", the prefix will be inserted here instead of at the beginning.

returnName Boolean

If true, returns the prefixed property name instead of the property value. Default to false.

Returns

The property value, or its name if returnName is true

Type
String | Object

<static> UWA.Utils.Client.isOnline(onLine, timeout) → {Boolean}

Check if current Client is online or not.

Parameters
Name Type Description
onLine Boolean

New value

timeout String

New value expiration

Returns

true if online else false.

Type
Boolean

<static> UWA.Utils.Client.getSize() → {Object}

Get viewport bounds (including page scrolling if any) of current window.

Returns

With "height" and "width" properties.

Type
Object

<static> UWA.Utils.Client.getScrolls() → {Object}

Obtain the scurrent crolling offsets in both the horizontal and vertical direction.

Returns

Object with "x" and "y" properties.

Type
Object

<static> UWA.Utils.Client.addStar(url, title)

Add Client Rating/Star/Favorite/...

Parameters
Name Type Description
url String

Url to Rate/Bookmark/Save

title String

Name of Bookmark