()
| 404 | input.checked = this.value; |
| 405 | input.oninput = this.onChange.bind(this); |
| 406 | this.input = new WeakRef(input); |
| 407 | div.append(input); |
| 408 | return div; |
| 409 | } |
| 410 | private onChange() { |
| 411 | this.owner.changed(); |
| 412 | const input = this.input.deref(); |
| 413 | if (input) { |
| 414 | const value = input.checked as boolean; |
| 415 | this.value = value; |
| 416 | this.onchange(value); |
| 417 | } |
| 418 | } |
| 419 | setState(state: boolean) { |
| 420 | if (this.input) { |
| 421 | const checkbox = this.input.deref(); |
| 422 | if (checkbox) { |
| 423 | checkbox.checked = state; |