Chemistry, asked by sharma90075454p38194, 1 year ago

method of writing polymer

Answers

Answered by pranalipranuup8bfmv
0
To add an instance method to your element, just add a method on the element's prototype.

Polymer({ is: 'cat-element', _says: 'meow', speak: function() { console.log(this._says); } });

You can invoke the method on any instance of your element.

var cat1 = document.querySelector('cat-element'); cat1.speak(); var cat2 = document.createElement('cat-element'); cat2.speak();
Similar questions