Created
December 3, 2016 18:46
-
-
Save domfarolino/abbc6d7a3693501bc43d0dc576cb11d0 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
class CoolButton extends HTMLButtonElement { | |
constructor() { | |
super(); // must call as usual | |
} | |
connectedCallback() { | |
this.addEventListener('click', this._onClick); | |
// Woohoo, we've been connected | |
} | |
_onClick() { | |
console.log('Yep, just clicked me'); | |
} | |
} | |
customElements.define("cool-button", CoolButton, {extends: "button"}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment