mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-15 04:04:50 +08:00
15 lines
385 B
JavaScript
15 lines
385 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;
|
|
}
|
|
|
|
click() {
|
|
this.enable() && this.value(!this.value());
|
|
}
|
|
}
|