silk-gui
Version:
GUI for developers and Node OS
25 lines (20 loc) • 433 B
JavaScript
var _ = require('../../util')
module.exports = {
bind: function () {
var self = this
var el = this.el
this.listener = function () {
self.set(el.checked, true)
}
_.on(el, 'change', this.listener)
if (el.checked) {
this._initValue = el.checked
}
},
update: function (value) {
this.el.checked = !!value
},
unbind: function () {
_.off(this.el, 'change', this.listener)
}
}