DeviceService Class
Devices detection service. Uses devicejs with noConflict, duplicates all devicejs methods inside service & implements some new methods.
Item Index
Methods
Methods
_onOrientationChange
()
private
Handles window's 'resize' & 'orientationchange' events.
isDesktop
()
Boolean
Get current device is desktop.
Returns:
Returns true, if device is desktop.
isMobile
()
Boolean
Get current device is phone.
Returns:
Returns true, if device is phone.
isMobile
()
Boolean
Get current device is phone.
Returns:
Returns true, if device is phone.
isTablet
()
Boolean
Get current device is tablet.
Returns:
Returns true, if device is tablet.
orientation
-
useCached
Returns current device orientation.
Parameters:
-
useCached
BooleanFlag: indicates whether to use already cached value or not.
Returns:
Returns current device orientation ('landscape' or 'portrait').
pathPrefixes
-
useCached
Returns path prefixes for application resources (such as templates, controllers, ...), related to current device platform, type, and orientation.
Parameters:
-
useCached
BooleanFlag: indicates whether to use already cached value or not.
Returns:
Path prefixes for application resources (such as templates, components...), related to current platform, device type, and orientation.
Properties
_cache
Object
private
Device service cache.
Sub-properties:
-
orientation
StringCached orientation ('portrait' or 'landscape').
-
platform
StringCached platform ('ios', 'windows', 'android', ...).
-
type
StringCached device type ('desktop', 'phone', 'tablet', or 'tv').
-
pathPrefixes
ObjectCached path prefixes.
-
pathPrefixes.landscape
String[]Cached path prefixes for 'landscape' orientation (for example 'ipad-landscape', 'ipad', 'tablet-landscape', 'tablet', 'mobile-landscape', 'mobile').
-
pathPrefixes.portrait
String[]Cached path prefixes for 'portrait' orientation (for example 'ipad-portrait', 'ipad', 'tablet-portrait', 'tablet', 'mobile-portrait', 'mobile').
prefixForOrientation
Boolean
If set as true
, each prefix for paths, returned by pathPrefixes
function, will be duplicated in format: 'prefix-currentOrientation'.
Default: false
prefixForPlatformAndType
Boolean
If set as true
, into prefixes for paths, returned by pathPrefixes
function, will be added prefix in format: 'platformName-deviceType'.
Default: false
prefixForType
Boolean
If set as true
, into prefixes for paths, returned by pathPrefixes
function, will be added prefix in format: 'deviceType'.
Default: false