Class Index | File Index

## Classes

- _global_
- M
- M.ActionSheetDialogView
- M.AlertDialogView
- M.Application
- M.Base64
- M.ButtonGroupView
- M.ButtonView
- M.ConfirmDialogView
- M.ContainerView
- M.Controller
- M.Cypher
- M.DataProvider
- M.Date
- M.DateValidator
- M.EmailValidator
- M.Environment
- M.EventDispatcher
- M.FormView
- M.GridView
- M.I18N
- M.ImageView
- M.LabelView
- M.ListItemView
- M.ListView
- M.LoaderView
- M.LocalStorageProvider
- M.Logger
- M.Math
- M.Model
- M.ModelAttribute
- M.ModelRegistry
- M.NotMinusValidator
- M.NumberValidator
- M.Object
- M.Observable
- M.PageView
- M.PhoneValidator
- M.PresenceValidator
- M.RecordManager
- M.RemoteStorageProvider
- M.Request
- M.ScrollView
- M.SearchBarView
- M.SelectionListItemView
- M.SelectionListView
- M.SHA256
- M.TabBarItemView
- M.TabBarView
- M.TextFieldView
- M.ToggleView
- M.ToolbarView
- M.UrlValidator
- M.Validator
- M.View
- M.ViewManager
- M.WebSqlProvider

# 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
--- | ---
| M.Environment()

Fields borrowed from class M.Object:
  type

Method Summary
Method Attributes | Method Name and Description
--- | ---
| getBrowserName() Returns the browser version as received from navigator object.
| getConnectionStatus(callback, url, timeout) Checks the connection status by sending an ajax request and waiting for the response to decide whether online or offline.
| getHeight() Returns the currently available height of the browser window.
| getPlatform() Returns the platform as received from navigator object.
| getSize() Returns the currently available width and height of the browser window as an array: 0 -> width 1 -> height
| getUserAgent() Returns the userAgent as received from navigator object.
| getWidth() Returns the currently available width of the browser window.

Methods borrowed from class M.Object:
  bindToCaller, create, destroy, extend, get, include, set

Class Detail
M.Environment()
Method Detail
{String} getBrowserName()
Returns the browser version as received from navigator object. E.g. "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's browser.

getConnectionStatus(callback, url, timeout)
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:
{function} callback
  The function to be called when request returns.
{String} url
  Optional. The request url. When not given, a request is made to google.com. (Note: Add a proxy: /google)
{Number} timeout
  Optional. Time in milliseconds until request is considered to be timed out. Defaults to 5 seconds.

{Number} getHeight()
Returns the currently available height of the browser window.

Returns:
  {Number} The height of the user's browser window.

{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 widht and height of the user's browser window.

{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.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Dec 08 2010 15:07:30 GMT+0100 (MEZ)