Marco St
Marco St

Reputation: 318

paper-dropdown-menu this._setValue(value);

i'm trying to understand the Polymer paper-dropdown-menu element but on line 355 there is a line

this._setValue(value);

I've searched the code and the code of the behaviours but can't figure out where the method _setValue is coming from?

can someone help me understand?

thanks

Upvotes: 1

Views: 42

Answers (1)

Tomasz Pluskiewicz
Tomasz Pluskiewicz

Reputation: 3662

The _setX(val) method is added by Polymer element constructor dynamically for read-only properties.

 Polymer({
   is: 'paper-dropdown-menu',
   properties: {
     value: {           
       readOnly: true
     }
   },
   someFunction: function() {
     this._setValue('x');

     // this will fail
     this.value = 'x';
   }
 });

See the documentation for reference.

Upvotes: 1

Related Questions