Last active
November 28, 2019 12:33
-
-
Save ilopX/74a7e8b5b3bee5e6d03c5b0d7b8b79ef to your computer and use it in GitHub Desktop.
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
export default function module() { | |
class Component { | |
/** | |
* | |
* @param {HTMLElement} anchor | |
*/ | |
constructor(anchor) { | |
this._anchor = anchor | |
this._props = {} | |
// this._renderView() | |
} | |
onInit() {} | |
onPropsChanges() { } | |
set props(value) { | |
this._props = value | |
this.onPropsChanges(this._props) | |
this._renderView() | |
} | |
get props() { | |
return { ...this._props } | |
} | |
// set anchor(element) { | |
// this._anchor = element | |
// this._renderView() | |
// } | |
get anchor() { | |
return this._anchor | |
} | |
_renderView() { | |
if (this._anchor) { | |
this._anchor.innerHTML = this.render() | |
} | |
} | |
render() { | |
return '' | |
} | |
} | |
return { | |
Component | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment