I have a mixin and a class that uses it, but within the mixin (or the class itself), I can't seem to get a list of all properties. this.config
is undefined
, and this.constructor.config
only gives me the list of properties in the current class (not those in the mixin itself).
See below for a more detailed example.
const myMixin = subclass => class extends subclass {
static get config() {
return {
properties: {
mixInVariable: {
type: String,
}
}
}
}
constructor() {
super();
console.log(this.constructor.config.properties);
}
}
class ContainerGrid extends myMixin(Polymer.Element) {
static get is() { return 'container-grid' }
static get config() {
// properties, observers meta data
return {
properties: {
something: {
type: String
}
}
};
}
}
customElements.define(ContainerGrid.is, ContainerGrid);
In the console, I only see the variable something
. How can I get a list of all properties (e.g. mixInVariable
and something
)?
From the
constructor
, usesuper.constructor.config.properties
to access the inherited properties.From
get properties()
, usesuper.config.properties
.codepen