snappymail/dev/Component/Checkbox.js
2022-10-10 13:52:56 +02:00

16 lines
416 B
JavaScript

export class CheckboxComponent {
constructor(params = {}) {
this.value = ko.isObservable(params.value) ? params.value
: ko.observable(!!params.value);
this.enable = ko.isObservable(params.enable) ? params.enable
: ko.observable(undefined === params.enable || !!params.enable);
this.label = params.label;
this.inline = params.inline;
}
click() {
this.enable() && this.value(!this.value());
}
}