Created
November 15, 2017 11:19
-
-
Save hectorlorenzo/efdb7add9d54d553d79236d443517f75 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const elemClass = class extends HTMLElement { | |
constructor() { | |
super() | |
} | |
connectedCallback () { | |
const o = this | |
const data = o.options.data | |
Object.keys(data).forEach((key) => { | |
Object.defineProperty(o, key, { | |
enumerable: true, | |
configurable: true, | |
get () { | |
return o.getAttribute(key) | |
}, | |
set (val) { | |
o.setAttribute(key, val) | |
} | |
}) | |
o[key] = data[key] | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment