Skip to content

Commit

Permalink
maker properties argument more generic to support other LitElement mi…
Browse files Browse the repository at this point in the history
…xins
  • Loading branch information
Sergey Kondratenko authored and Sergey Kondratenko committed Sep 12, 2019
1 parent d8fae34 commit 6fec92b
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/component.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { HauntedLitElement } from './HauntedLitElement.js';

export const litElementComponent = (renderer, props = {}, baseCls = HauntedLitElement) =>
class extends baseCls {
static get styles() {
return props.styles || [];
}

static get properties() {
return props.properties || {};
}

export const litElementComponent = (renderer, props = {}, baseCls = HauntedLitElement) => {
const retCls = class extends baseCls {
render() {
return renderer.call(this, this);
}
};

Object.entries(props).forEach(([key, val]) => {
retCls[key] = val;
});

return retCls;
};

0 comments on commit 6fec92b

Please sign in to comment.