Skip to content

Instantly share code, notes, and snippets.

@freshcutdevelopment
Last active September 5, 2017 10:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save freshcutdevelopment/e427ad9f33346c5856f5f5bdf4590f50 to your computer and use it in GitHub Desktop.
Web component custom elements
class XInfoCard extends HTMLElement{
// Monitor the 'message' attribute for changes.
static get observedAttributes() {return ['message']; }
// Respond to attribute changes.
attributeChangedCallback(attr, oldValue, newValue) {
if (attr == 'message') {
this.textContent = newValue;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment