I've a custom Polymer element with a published property inputValue
.
The component listen for inputValue
changes, and when it changes report the new value to an internal logic.
The same is done in the opposite direction: the element listen for internal logic changes and set the new value to the inputValue
.
When the new value is set to inputValue
this make the observe system notify all the listeners, but the element is itself a listener.
I want to avoid that the element is notified about changes made by itself.
Here the custom element Dart code:
@CustomTag("codemirror-input")
class CodemirrorInput extends PolymerElement {
@published
String mode;
@published
String inputValue;
CodemirrorInput.created() : super.created();
void ready() {
Map options = {
'mode': mode
};
GradeCodeMirror editor = new GradeCodeMirror.fromElement(
$['codemirror'], options: options);
onPropertyChange(this, #inputValue, (){
editor.setOption("value", inputValue);
});
editor.onChange.listen((_){
inputValue = editor.getDoc().getValue();
});
}
}
value
from your code and let Polymer resolve the updating? What makeseditor.onChange.listen
fire? – Günter Zöchbauervalue
is bound to? – Günter Zöchbauer