This webcomponent follows the open-wc recommendation.
npm i computing-lit-element
<script type="module">
import ComputingLitElement from 'computing-lit-element';
class MyElement extends ComputingLitElement {
static get properties() {
return {
property1: {
type: Number
},
property2: {
type: Number
},
computedProperty: {
type: Number,
computed: 'computeComputedProperty(property1, property2)'
}
};
}
constructor() {
super();
this.property1 = 10;
this.property2 = 5;
}
computeComputedProperty(property1, property2) {
return property1 * property2;
}
}
</script>
<script type="module">
import computingMixin from 'computing-lit-element';
import { LitElement } from 'lit-element';
const ComputingLitElement = computingMixin(LitElement);
...
npm run test
npm run test:bs
npm run lint