Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = Button
- function Button(state) {
- if (!(this instanceof Button)) return new Button(state)
- this.type = 'Widget'
- this.state = state
- }
- Button.prototype.init = function () {
- var elem = document.createElement('button')
- elem.setInnerHTML = 'clicks: ' + this.state.clicks
- return elem
- }
- Button.prototype.update = function (prev, elem) {
- // state is mutated, so nothing to do here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement