Class: MobileAge

MobileAge(options)

namespace wrapper

Constructor

new MobileAge(options)

Class used to capsulate the general functions
Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Default Description
debug Boolean <optional>
false Specifies, whether the component sents debug output to the console.log or not
bem_BM String <optional>
"--" String for modifier seperator (BEM)
bem_BE String <optional>
"__" String for modifier seperator (BEM)
data String <optional>
null JSON-encoded data to be provided during initialisation. If data is manually provided, no xhr-service will be requested
xhrMethod String <optional>
"GET" Method to request data from the server. Possible values: "GET" or "POST"
xhrSource String <optional>
"" URL for the data source used by the Request
xhrVar String <optional>
"" Wrapping variable for "GET"-requests (e.g. http://server?xhrVar=something)
dataPath String <optional>
"" If the requested data is capsulated as a value of the response array, the dataPath represents the path to the requested data
onData function <optional>
null Callback-function called every time the list data has to be loaded from a file or a server.
onComplete function <optional>
null Callback-function called when all data is rendered.
Source:

Classes

Component
Layer

Methods

(static) _assignOptions(object, properties)

Assign options merged with defaultOption of the class
Parameters:
Name Type Description
object object default options
properties object child options
Source:

(static) _fetchFromObject(object, path)

Recursive value retrieval by value path within object
Parameters:
Name Type Description
object obj to get value from
path prop to value in dot-notation
Source:

(static) _focussable(parent)

Returns first focussable element for given node
Parameters:
Name Type Description
parent elem element to query
Source:

(static) _onRequestData(data)

Abstract Method, may overwritten by sub classes
Parameters:
Name Type Description
data object requested data
Source:

(static) _onRequestDataError(data)

Abstract Method, may overwritten by sub classes
Parameters:
Name Type Description
data object requested data
Source:

(static) _parseData(data)

Parses the JSON data and creates a data array as a member variable @_data
Parameters:
Name Type Description
data array JSON data record
Source:

(static) _xhrRequestJSON(source, json, method, onData, onError, credentials, callbackData)

Creates and send a XMLHttpRequest using JSON coded Data and attaches callbacks.
Parameters:
Name Type Description
source string URL of the data source
json object JSON-Data to be send
method string method of the request ('GET' or 'POST'); default:'POST'
onData function callback for a successfull request; default: this._onRequestData()
onError function callback for a successfull request; default: this._onRequestDataError()
credentials boolean specify if credentials are used in the request.
callbackData object data to be passed to the '_onRequestData'-callback-function
Source:

(static) _xhrRequestQuery(source)

Creates and send a XMLHttpRequest using an URL-Query and attaches callbacks. Not implemented, yet
Parameters:
Name Type Description
source string URL of the data source
Source:

(static) _xhrRequestXML(source)

Creates and send a XMLHttpRequest using an XML coded data and attaches callbacks. Not implemented, yet
Parameters:
Name Type Description
source string URL of the data source
Source:

(static) Array::filter(fun)

Polyfill Array.filter() for older browsers
Parameters:
Name Type Description
fun function filter function
Source:

(static) bemify(dom, block, modifier)

Adds block and modifier classname to a given DOM-Element, according to the BEM-Methodology
Parameters:
Name Type Description
dom node dom-element
block string block or block-element pre-fix
modifier string modifier post-fix
Source:

(static) getElement(query) → {node}

wraps document.getElementById
Parameters:
Name Type Description
query String Id
Source:
Returns:
element - DOM-Element with Id
Type
node

(static) getOptions() → {object}

Get the actual options of the Element
Source:
Returns:
returns the options array
Type
object

(static) html2DomElement(html)

Creates dom-elements from a html string
Parameters:
Name Type Description
html string a string containig valid html
Source:

(static) isValidId(id) → {boolean}

Tests if the given string is a valid id according html 4 spec
Parameters:
Name Type Description
id String id to be tested
Source:
Returns:
returns 'true' if the given string is a valid html-id
Type
boolean

(static) linearize(data) → {object}

Creates a linearized version of the data object. keys were concatinated by a "."
Parameters:
Name Type Description
data object a data object
Source:
Returns:
returns the object
Type
object

(static) log()

Log options. For debug purposes.
Source:

(static) queryData()

Sends the XHR Request to the data source
Source:

(static) querySelector(query) → {DOM-Element}

wraps document.querySelectorAll
Parameters:
Name Type Description
query String
Source:
Returns:
element
Type
DOM-Element

(static) querySelector(query) → {DOM-Element}

wraps document.querySelector
Parameters:
Name Type Description
query String
Source:
Returns:
element
Type
DOM-Element

(static) removeAllChildren(dom)

Removes all children of the given DOM-Element
Parameters:
Name Type Description
dom node a DOM-Element
Source:

(static) template(template, element, engine) → {string}

Creates a new dom-element by wrapping a dom-Element with a template
Parameters:
Name Type Description
template string a template string with placeholder
element array a dom element witch has to be wraped
engine string the internal templating engine to be used (optional)
Source:
Returns:
returns a dom-element
Type
string

(static) template(template, data, engine) → {string}

Creates a html string by copy data into a template
Parameters:
Name Type Description
template string a template string with placeholder
data array a data array
engine string the internal templating engine to be used (optional)
Source:
Returns:
returns a html-string
Type
string