Skip to content

Instantly share code, notes, and snippets.

@sumbad
Last active July 3, 2017 15:43
Show Gist options
  • Save sumbad/37da0a615fb65b3cc5b6f3eb728fb5a5 to your computer and use it in GitHub Desktop.
Save sumbad/37da0a615fb65b3cc5b6f3eb728fb5a5 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Custom Elements</title>
<script type="text/javascript">
class FirstCustomElement extends HTMLElement {
constructor() {
super();
console.log('constructor');
}
connectedCallback() {
console.log('connectedCallback');
}
static get observedAttributes() {
return ['test']
}
attributeChangedCallback(name, oldValue, newValue) {
console.log('attributeChangedCallback ', name, oldValue, newValue);
}
disconnectedCallback() {
console.log('disconnectedCallback');
}
}
window.customElements.define('first-custom-element', FirstCustomElement);
</script>
</head>
<body>
<first-custom-element></first-custom-element>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment