This member of damo contains the fundamental functions of damo.
It should not be modified by the developper, unless Damo could
break.
Methods
damo.method.addSlashes(str)
This method returns a given string with appropriate slashes to be used in the regular expressions
Parameters:
Name | Type | Description |
---|---|---|
str |
string | a string that has to be slashed |
Returns:
a string with special characters slashed
damo.method.build(scope)
This method build the entire application scope at the start.
Parameters:
Name | Type | Description |
---|---|---|
scope |
jqueryElement | The concerned JQuery scope element |
damo.method.BuildDirectives()
This method replaces in the DOM the tag with attribute "damo-seed" by the template of the directive.
damo.method.BuildLoops(scope)
This method builds all the loops of a scope
Parameters:
Name | Type | Description |
---|---|---|
scope |
jqueryElement | the JQuery scope element |
damo.method.BuildSingleLoop(elem)
This method replaces in the DOM the tag with attribute "damo-loop" by the corresponding list of the datamodel.
Parameters:
Name | Type | Description |
---|---|---|
elem |
jqueryElement | the JQuery element with attribute "damo-loop" |
damo.method.feedDirectives()
This method builds the object damo.routing from the file js/routing.js.
damo.method.getLang(scope)
This method feeds the object "damo.dm.lang" with content of the file "js/myLang.json".
Parameters:
Name | Type | Description |
---|---|---|
scope |
jqueryElement | The concerned JQuery scope element |
damo.method.getValue(item)
This method retrieve the value of an element of the datamodel, given its path
Parameters:
Name | Type | Description |
---|---|---|
item |
string | a string describing the path of the element to retrieve from the datamodel |
Example
firstname = damo.method.getValue('user.info.firstName');
damo.method.renewLoop(str)
This method updates a loop. It is useful for damoRefresh().
Parameters:
Name | Type | Description |
---|---|---|
str |
string | The value of the attribute "damo-loop" |
damo.method.setConditions()
This method parses the DOM to setup the "damo-if" conditions
damo.method.SetDomValues(scope)
This method sets all the tags with an attribute "damo-id", with the corresponding value of the datamodel
Parameters:
Name | Type | Description |
---|---|---|
scope |
jqueryElement | The JQuery scope element |
damo.method.setLang(scope)
This method feeds tags with an attribute "damo-lang" of a whole scope, with its value found in the file "js/myLang.json"
Parameters:
Name | Type | Description |
---|---|---|
scope |
jqueryElement | The concerned JQuery scope element |
damo.method.setSingleValue(el)
This method enables to set the value of a DOM element accordingly to
its damo-id attribute, which shall correspond to a branch of the
datamodel.
Parameters:
Name | Type | Description |
---|---|---|
el |
jqueryElement | The jquery element which value has to be set accordingly to its 'damo-id' attribute. |
Example
The DOM element <input damo-id="user.info.userName"> will take the
value damo.dm.user.info.userName.
damo.method.setTriggers()
This method sets all the triggers associated with the tags with an attribute "damo-triger"
damo.method.trySearch(expr)
This method enables to find the value of an element of the datamodel,
given the path of this element as a string.
Parameters:
Name | Type | Description |
---|---|---|
expr |
string | The datamodel element as a string. |
Example
The search for the string "user.info.userName" will return the value
of damo.dm.user.info.userName
damo.method.twoWayDataBinding()
This method implements the two-way data binding of Damo. Any HTML
change is encapsulated inside a code that will simultaneously modify
the corresponding branch of the datamodel.