polymer icon indicating copy to clipboard operation
polymer copied to clipboard

Passing property name in property observer effect to the observing method

Open aahoo opened this issue 10 years ago • 2 comments

Changing this line to

      fn.call(this, value, old, effect.property);

will make property observers way more useful. They can virtually replace the complex observer effect. In addition, the function being called knows what has changed from what to what to take the needed action.

aahoo avatar Jul 11 '16 14:07 aahoo

Ideally we would just get the whole event information. See #3554 where I propose to also get the fromAbove value. Likewise #3573 where I propose custom effects which get both the path (property) you want and the fromAbove flag.

kaste avatar Jul 23 '16 14:07 kaste

In general simple observers do not need this information, as they should be unique. If you do want to have 1 observer for all your properties, you can implement that yourself with a solution like http://jsbin.com/jiyawurudo/edit?html,console,output In general, the advice is to not duplicate this behavior and instead use a complex observer for these purposes.

TimvdLippe avatar Feb 11 '18 15:02 TimvdLippe