Last active
March 20, 2019 17:14
-
-
Save kylebuch8/95c5e8318a77d78a7789c688374eee14 to your computer and use it in GitHub Desktop.
Simple PFElement Constructor
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
// the location of pfelement.js may be different if you're not building an element in the | |
// PatternFly elements repository | |
import PFElement from "../pfelement/pfelement.js"; | |
class MySimplePfelement extends PFElement { | |
constructor() { | |
// make sure we call super() first with the class we're using | |
// as the first argument | |
super(MySimplePfelement); | |
// example state data | |
this.opened = false; | |
// example binding of this to a private method | |
this._clickHandler = this._clickHandler.bind(this); | |
// example event listener | |
this.addEventListener("click", this._clickHandler); | |
} | |
_clickHandler(event) { | |
// handle the click event | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment