Class Index | File Index

Classes


Class M.Environment


Extends M.Object.
M.Environment encapsulates methods to retrieve information about the environment, like browser used, platform, user agent (based on navigator object) or whether or not the device is online (determined via an ajax request).
Defined in: environment.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
 
The type of this object.
Method Summary
Method Attributes Method Name and Description
 
getConnectionStatus(callback, url)
Checks the connection status by sending an ajax request and waiting for the response to decide whether online or offline.
 
Returns the currently available height of the browser window.
 
This method returns the device's current orientation, depending on whether or not the device is capable of detecting the current orientation.
 
Returns the platform as received from navigator object.
 
Returns the currently available width and height of the browser window as an array: 0 -> width 1 -> height
 
Returns the total height of the page/document, means not only the area of the browser window.
 
Returns the total size of the page/document, means not only the area of the browser window.
 
Returns the total width of the page/document, means not only the area of the browser window.
 
Returns the userAgent as received from navigator object.
 
Returns the currently available width of the browser window.
 
This method checks if the browser supports a certain input type specified with HTML5.
Methods borrowed from class M.Object:
bindToCaller, create, destroy, extend, get, include, set
Class Detail
M.Environment()
Field Detail
{String} type
The type of this object.
Method Detail
getConnectionStatus(callback, url)
Checks the connection status by sending an ajax request and waiting for the response to decide whether online or offline. The callback is called when the request returns successful or times out. The parameter to callback is a string saying either offline or online.
Parameters:
{Object} callback
The object, consisting of target and action, defining the callback.
{String} url
Optional. The request url. When not given, a request is made to http://www.google.de/images/logos/ps_logo2.png.

{Number} getHeight()
Returns the currently available height of the browser window.
Returns:
{Number} The height of the user's browser window.

{Number|Boolean} getOrientation()
This method returns the device's current orientation, depending on whether or not the device is capable of detecting the current orientation. If the device is unable to detect the current orientation, this method will return NO. Possible return values are: - M.PORTRAIT - M.LANDSCAPE_LEFT - M.LANDSCAPE_RIGHT
Returns:
{Number|Boolean} The orientation type as a constant value. (If the orientation can not be detected: NO.)

{String} getPlatform()
Returns the platform as received from navigator object. E.g. "MacIntel"
Returns:
{String} The user's platform.

{Array} getSize()
Returns the currently available width and height of the browser window as an array: 0 -> width 1 -> height
Returns:
{Array} The width and height of the user's browser window.

{Number} getTotalHeight()
Returns the total height of the page/document, means not only the area of the browser window. Uses jQuery.
Returns:
{Number} The total height of the document.

{Array} getTotalSize()
Returns the total size of the page/document, means not only the area of the browser window. 0 -> width 1 -> height
Returns:
{Array} The width and height of the document.

{Number} getTotalWidth()
Returns the total width of the page/document, means not only the area of the browser window. Uses jQuery.
Returns:
{Number} The total width of the document.

{String} getUserAgent()
Returns the userAgent as received from navigator object. E.g. "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7"
Returns:
{String} The user agent.

{Number} getWidth()
Returns the currently available width of the browser window.
Returns:
{Number} The width of the user's browser window.

{Boolean} supportsInputType(inputTye)
This method checks if the browser supports a certain input type specified with HTML5. This check is based on Modernizr. For further information abbout the input types, take a look at the W3C spec: http://dev.w3.org/html5/spec/Overview.html#states-of-the-type-attribute
Parameters:
{String} inputTye
The HTML5 input type to be checked.
Returns:
{Boolean} A flag telling you if the input type is supported or not.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Jan 25 2012 20:41:10 GMT+0100 (MEZ)