Permalink
Browse files

feat(SyntaxInterpreter): add from-view, to-view commands

  • Loading branch information...
bigopon authored and jdanyow committed Sep 15, 2017
1 parent df1bc30 commit 23938a68178fed3b34573dd02d45d50af1f307de
Showing with 18 additions and 2 deletions.
  1. +18 −2 src/syntax-interpreter.js
View
@@ -244,20 +244,34 @@ export class SyntaxInterpreter {
return instruction;
}
'one-way'(resources, element, info, existingInstruction) {
'to-view'(resources, element, info, existingInstruction) {
let instruction = existingInstruction || BehaviorInstruction.attribute(info.attrName);
instruction.attributes[info.attrName] = new BindingExpression(
this.observerLocator,
this.attributeMap.map(element.tagName, info.attrName),
this.parser.parse(info.attrValue),
bindingMode.oneWay,
bindingMode.toView,
resources.lookupFunctions
);
return instruction;
}
'from-view'(resources, element, info, existingInstruction) {
let instruction = existingInstruction || BehaviorInstruction.attribute(info.attrName);
instruction.attributes[info.attrName] = new BindingExpression(
this.observerLocator,
this.attributeMap.map(element.tagName, info.attrName),
this.parser.parse(info.attrValue),
bindingMode.fromView,
resources.lookupFunctions
);
return instruction;
}
'one-time'(resources, element, info, existingInstruction) {
let instruction = existingInstruction || BehaviorInstruction.attribute(info.attrName);
@@ -272,3 +286,5 @@ export class SyntaxInterpreter {
return instruction;
}
}
SyntaxInterpreter.prototype['one-way'] = SyntaxInterpreter.prototype['to-view'];

0 comments on commit 23938a6

Please sign in to comment.