Class

Controller

Controller(model, view)

Class representing a Controller.
Constructor

# new Controller(model, view)

Create a controller.
Parameters:
Name Type Description
model object The model object.
view object The view object.

View Source controller.js, line 8

Classes

Controller

Methods

# buildView(selector)

Build the DOM elements.
Parameters:
Name Type Description
selector string DOM selector to the element, where to mount the app.

View Source controller.js, line 85

# configurate(data)

Configurate the behavior of the controller. Derivated controllers can define their own properties by overriding the method propertyNames.
Parameters:
Name Type Description
data object Configuration data as object with key/value pairs.

View Source controller.js, line 30

# fetchJsonData(url, identifier)

Fetch JSON data from URL.
Parameters:
Name Type Description
url string URL to the data source.
identifier any Property which handlers can use to identify the type of data.

View Source controller.js, line 127

# formatNumber(value, locale, minFractionDigits, maxFractionDigits)

Formats a value for display
Parameters:
Name Type Description
value number The value to format.
locale string An optional locale, i.e. 'us/EN' or 'de/DE'.
minFractionDigits int An optional value for the minium amount of digits.
maxFractionDigits int An optional value for the maxium amount of digits.

View Source controller.js, line 153

# getComponentById(id)

Get a component by id.
Parameters:
Name Type Description
id string Id of component to get.

View Source controller.js, line 94

# getPropertyNames(customPropertyNames) → {array}

Get property names.
Parameters:
Name Type Description
customPropertyNames array An array with the names of a derived class.

View Source controller.js, line 46

An array with property names or undefined, if no properties exist.
array

# sendMessageToComponent(id, message)

Send a message to a specific component.
Parameters:
Name Type Description
id string The id of the component, which should receive the message.
message any The component is responsible for the interpretation of the message.

View Source controller.js, line 113

# sendMessageToView(message)

Send a message to the current view.
Parameters:
Name Type Description
message any The component is responsible for the interpretation of the message.

View Source controller.js, line 103

# setContext(context)

Set new controller context.
Parameters:
Name Type Description
context class The new context to be activated.

View Source controller.js, line 76

# setProperties(id, data)

Set properties for a single component.
Parameters:
Name Type Description
id int The id of the component to change.
data object The properties to change.

View Source controller.js, line 63

# static numberToString(value, maxFractionDigits) → {string}

Converts a float to a string with a maximum of fractional digits.
Parameters:
Name Type Description
value number The value to convert.
maxFractionDigits int An optional value for the maxium amount of decimal digits.

View Source controller.js, line 187

A string representing the number with specified decimal digits.
string