Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. module.exports = Button
  2.  
  3. function Button(state) {
  4. if (!(this instanceof Button)) return new Button(state)
  5. this.type = 'Widget'
  6. this.state = state
  7. }
  8.  
  9. Button.prototype.init = function () {
  10. var elem = document.createElement('button')
  11. elem.setInnerHTML = 'clicks: ' + this.state.clicks
  12. return elem
  13. }
  14.  
  15. Button.prototype.update = function (prev, elem) {
  16. // state is mutated, so nothing to do here
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement