I have code like this in my app:
observers: [
'_dataGenericObserver(userData.generic)',
],
// If this.userData.generic.id is set, then the register tab is
// NOT visible. In this case, the selected tab mustn't be
"register"...
_dataGenericObserver: function(){
if (this.userData.generic.id){
this.selected = 'login';
} else {
if (this.defaultRegister) {
this.selected = 'register';
} else {
this.selected = 'login';
}
}
},
Is this safe? Or should I *always* do this instead:
observers: [
'_dataGenericObserver(userData.generic)',
],
// If this.userData.generic.id is set, then the register tab is
// NOT visible. In this case, the selected tab mustn't be
"register"...
_dataGenericObserver: function(generic){
if (generic.id){
this.selected = 'login';
} else {
if (this.defaultRegister) {
this.selected = 'register';
} else {
this.selected = 'login';
}
}
},
...?
I noticed in some cases in other parts of the app that if I have an
observer on `_someFunc(value.subvalue)`, and then have `_someFunc:
function( subValue)`, in the function `subValue` is set, whereas
`this.value.subValue` isn't. However, I am not able to replicate it - sorry.
Questions:
* Is it always recommended to use the values passed to the functions,
rather than `this.*`?
* WHEN is it likely to happen, that a `subValue` is set as a function
parameter, but NOT in `this.value.subValue`?
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/166fbdef-69d4-4b08-9b24-711046c23ca0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.