.insertProcess - PeterNaydenov/code-assembly-line GitHub Wiki
Insert new process.
tplEngine.insertProcess ( extProcess , processName )
- extProcess: processStep[]. Describes render as order list of steps. Steps could do data-object manipulations, drawing data with templates, create new templates, and more.;
- processName: string;
- Method return options:
- tplEngine;
- Method is chainable;
Example:
const templates = {
'hello' : 'Hello {{user}}' // template 'hello'
}
const sayHi = [
{ do: 'draw', tpl: 'hello' } // process-step 'draw'. Will draw data with template 'hello'
]
tplEngine
.insertTemplate ( templates )
.insertProcess ( sayHi, 'hi')
// template engine is ready to use
const result = tplEngine.run ( 'hi', { user:'Peter'} )
// -> result == ['Hello Peter']