The names that appear in the [Placeholders] are primarily meant in the narrowest scope they can be found in. The scopes in order of specificity are as follows:
/*
(this belongs to the engine.js) transplate.node.js script should generate
<script> elements describing such scopes. The in-browser template engine
would build a hierarchy of scopes.
*/
class Scope {
constructor(parentScope) {
this.map = {}
this.parentScope = parentScope
}
// a block is entered, which may have local definitions
// - the html page
// - an html template
// - a custom component
enter() {
return new Scope(this)
}
// a block is exited, need to remove its local definitions from the scope
exit() {
return parentScope
}
// add a definition that is local to the current block
add(name, getter) {
this.map[name] = getter
}
// get the getter for a name; consider the innermost one if overdefined
getGetter(name) {
for (var s = this; s != null; s = s.parentScope) {
if (name in s.map) {
return s.map[name]
}
}
}
}