Reputation: 1092
I'm tying to create a classMixin in Polymer which provides custom methods and will be inherited by other elements.
Everything is working as expected, but I want to inherit some properties as well.
static get properties() {
return {
// Make this protected
test: {
value: 'test',
}
};
}
How would I make this test
property protected, so it can be used by the inheriting class?
Upvotes: 1
Views: 153
Reputation: 1102
Just add an underscore when you declare it
static get properties() {
return {
// Make this protected
_test: {
value: 'test',
}
};
}
Upvotes: 2
Reputation: 6579
So there are no visibility modifiers like protected in JavaScript. To use these properties in different classes just create another mixin that declares the properties.
Upvotes: 0