- Source:
Module used for template rendering
Example
Application.require('js-template').then(function (jsTemplate) {
jsTemplate.parseContent(
document.body,
function (err, config) { console.log(config) },
{ context: {}, args: { item: 'sample reference' }}
);
}, console.error);
Methods
(protected, static) attrParser(attr) → {JSTemplate.jsTemplate_attrResult}
- Source:
Parsing NodeElement Attribute
Parameters:
Name | Type | Description |
---|---|---|
attr |
JSTemplate.jsTemplate_Attribute |
Returns:
(protected, static) expressionBuilder(code, config)
- Source:
Expression Builder
Parameters:
Name | Type | Description |
---|---|---|
code |
string | |
config |
JSTemplate.parseTextNodesConfig |
(protected, static) nodeParser(nodeElement, cb, config) → {JSTemplate.parseTextNodesConfig}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
nodeElement |
HTMLElement | |
cb |
JSTemplate.nodeParserCallback | |
config |
JSTemplate.parseTextNodesConfig |
Returns:
(protected, static) parseTextNodes(textNode, cb, config)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
textNode |
HTMLElement | Node | Text | |
cb |
JSTemplate.parseTextNodesCallback | |
config |
JSTemplate.parseTextNodesConfig |
(protected, static) textParser(bf, config) → {JSTemplate.jsTemplate_textResult}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
bf |
Array.<Text> | |
config |
parseTextNodesConfig |
Returns:
Type Definitions
jsTemplate_Attribute
- Source:
Properties:
Name | Type | Description |
---|---|---|
name |
string | |
value |
string |
Type:
- Object
jsTemplate_attrResult
- Source:
Properties:
Name | Type | Description |
---|---|---|
type |
'event' | 'attribute' | 'binding' | 'macro' | |
attr |
JSTemplate.jsTemplate_Attribute | |
data |
JSTemplate.jsTemplate_attrResultAttributeData |
Type:
- Object
jsTemplate_attrResultAttributeData
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string | attribute name |
||
code |
string | executable code |
||
node |
HTMLElement | node element |
||
buffer |
any |
<optional> |
( technical property ) |
|
inline |
boolean |
<optional> |
false
|
should be value be parsed |
postProcess |
boolean |
<optional> |
false
|
should be value be parsed |
Type:
- Object
jsTemplate_textResult
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string |
<optional> |
'text'
|
|
data |
JSTemplate.jsTemplate_textResultData |
Type:
- Object
jsTemplate_textResultData
- Source:
Properties:
Name | Type | Description |
---|---|---|
nodes |
Array.<Text> | |
initialNodes |
Array.<Text> | |
code |
string |
Type:
- Object
jsTemplateAttrData
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
nodes |
Array.<JSTemplate.jsTemplate_attrResult> | |||
texts |
Array.<JSTemplate.jsTemplate_textResult> | |||
children |
Array.<JSTemplate.jsTemplateAttrData> | |||
_macro |
Object.<string, JSTemplate.jsTemplate_attrResult> | |||
HAS_POST_PROCESS |
boolean |
<optional> |
false
|
Type:
- Object
JSTemplateModule
- Source:
Properties:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
parseContent |
JSTemplate.JSTemplateParseContent | ||||||||||||||||
config |
object |
Properties
|
Type:
- Object
(protected) JSTemplateParseContent(nodeElement, cb, config) → {JSTemplate.parseTextNodesConfig}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
nodeElement |
HTMLElement | |
cb |
JSTemplate.nodeParserCallback | |
config |
JSTemplate.parseTextNodesConfig |
Returns:
(protected) nodeParserCallback(err, config) → {JSTemplate.parseTextNodesConfig}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
err |
Error | |
config |
JSTemplate.parseTextNodesConfig |
Returns:
parseTextNodesCallback(err, config)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
err |
Error | |
config |
JSTemplate.parseTextNodesConfig |
parseTextNodesConfig
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
args |
object |
<optional> |
{}
|
arguments |
context |
object |
<optional> |
{}
|
execution context |
start |
string |
<optional> |
'{{'
|
start token |
end |
string |
<optional> |
'}}'
|
end token |
textNodes |
Array.<JSTemplate.jsTemplate_textResult> |
<optional> |
array of TextNodes |
|
buffer |
Array.<Text> |
<optional> |
(technical property) buffer |
|
opened |
boolean |
<optional> |
false
|
(technical property) |
__argsNames |
Array.<string> |
<optional> |
(technical property) |
|
__argsValues |
Array.<any> |
<optional> |
(technical property) |
Type:
- Object