So, if I understand correctly, the goal is to use one observer for several property changes, and inside the observer you should be able to determine the name of the changed property.
I experimented a bit and found out that you can achieve this with the help of deep observers outside.
<!doctype html> <html> <head> <meta name="description" content="http://stackoverflow.com/questions/28265025"> <meta charset="utf-8"> <base href="http://polygit.org/components/"> <script href="webcomponentsjs/webcomponents-lite.min.js"></script> <link href="polymer/polymer.html" rel="import"> </head> <body> <dom-module id="x-el"> <template> <p>path: {{path}}</p> <p>value: {{value}}</p> <button on-click="incrementNumber1">increment number 1</button> <button on-click="incrementNumber2">increment number 2</button> </template> <script> Polymer({ is: 'x-el', properties: { path: { type: String, notify: true }, value: { type: String, notify: true }, number1: { type: Number, value: 0, notify: true }, number2: { type: Number, value: 0, notify: true }, }, observers: [ 'onChange(number1.*)', 'onChange(number2.*)' ], incrementNumber1: function() { this.number1 += 1; }, incrementNumber2: function() { this.number2 += 1; }, onChange: function(changeRecord) { this.path = changeRecord.path; this.value = changeRecord.value; } }); </script> </dom-module> <x-el></x-el> </body> </html>
https://jsbin.com/pufexay/edit?html,output
source share