-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
maker properties argument more generic to support other LitElement mi…
…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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |