# JSTemplate

Source:
  - constructors/js-template.js, line 10

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:
  - constructors/js-template.js, line 446

Parsing NodeElement Attribute

##### Parameters:

Name | Type | Description
--- | --- | ---
`attr` | JSTemplate.jsTemplate_Attribute |

##### Returns:

Type
  JSTemplate.jsTemplate_attrResult

#### (protected, static) expressionBuilder(code, config)

Source:
  - constructors/js-template.js, line 64

Expression Builder

##### Parameters:

Name | Type | Description
--- | --- | ---
`code` | string |
`config` | JSTemplate.parseTextNodesConfig |

#### (protected, static) nodeParser(nodeElement, cb, config) → {JSTemplate.parseTextNodesConfig}

Source:
  - constructors/js-template.js, line 997

##### Parameters:

Name | Type | Description
--- | --- | ---
`nodeElement` | HTMLElement |
`cb` | JSTemplate.nodeParserCallback |
`config` | JSTemplate.parseTextNodesConfig |

##### Returns:

Type
  JSTemplate.parseTextNodesConfig

#### (protected, static) parseTextNodes(textNode, cb, config)

Source:
  - constructors/js-template.js, line 250

##### Parameters:

Name | Type | Description
--- | --- | ---
`textNode` | HTMLElement | Node | Text |
`cb` | JSTemplate.parseTextNodesCallback |
`config` | JSTemplate.parseTextNodesConfig |

#### (protected, static) textParser(bf, config) → {JSTemplate.jsTemplate_textResult}

Source:
  - constructors/js-template.js, line 102

##### Parameters:

Name | Type | Description
--- | --- | ---
`bf` | Array.<Text> |
`config` | parseTextNodesConfig |

##### Returns:

Type
  JSTemplate.jsTemplate_textResult

### Type Definitions

#### jsTemplate_Attribute

Source:
  - constructors/js-template.js, line 400

##### Properties:

Name | Type | Description
--- | --- | ---
`name` | string |
`value` | string |

##### Type:

- Object

#### jsTemplate_attrResult

Source:
  - constructors/js-template.js, line 418

##### Properties:

Name | Type | Description
--- | --- | ---
`type` | 'event' | 'attribute' | 'binding' | 'macro' |
`attr` | JSTemplate.jsTemplate_Attribute |
`data` | JSTemplate.jsTemplate_attrResultAttributeData |

##### Type:

- Object

#### jsTemplate_attrResultAttributeData

Source:
  - constructors/js-template.js, line 407

##### 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:
  - constructors/js-template.js, line 26

##### Properties:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`type` | string | <optional> | `'text'` |
`data` | JSTemplate.jsTemplate_textResultData |  |  |

##### Type:

- Object

#### jsTemplate_textResultData

Source:
  - constructors/js-template.js, line 33

##### Properties:

Name | Type | Description
--- | --- | ---
`nodes` | Array.<Text> |
`initialNodes` | Array.<Text> |
`code` | string |

##### Type:

- Object

#### jsTemplateAttrData

Source:
  - constructors/js-template.js, line 426

##### 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:
  - constructors/js-template.js, line 1

##### Properties:

Name | Type | Description
--- | --- | ---
`parseContent` | JSTemplate.nodeParser |
`config` | object | ###### Properties
Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`RENDER_FPS` | number | <optional> | `15` |
`REMOVE_EMPTY_NODES` | number | <optional> | `true` |

##### Type:

- Object

#### (protected) nodeParserCallback(err, config) → {JSTemplate.parseTextNodesConfig}

Source:
  - constructors/js-template.js, line 980

##### Parameters:

Name | Type | Description
--- | --- | ---
`err` | Error |
`config` | JSTemplate.parseTextNodesConfig |

##### Returns:

Type
  JSTemplate.parseTextNodesConfig

#### parseTextNodesCallback(err, config)

Source:
  - constructors/js-template.js, line 235

##### Parameters:

Name | Type | Description
--- | --- | ---
`err` | Error |
`config` | JSTemplate.parseTextNodesConfig |

#### parseTextNodesConfig

Source:
  - constructors/js-template.js, line 41

##### 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