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