MCPcopy Create free account
hub / github.com/MathMan05/Fermi / ButtonInput

Class ButtonInput

src/webpage/settings.ts:393–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

391 input.checked = this.value;
392 input.oninput = this.onChange.bind(this);
393 this.input = new WeakRef(input);
394 div.append(input);
395 return div;
396 }
397 private onChange() {
398 this.owner.changed();
399 const input = this.input.deref();
400 if (input) {
401 const value = input.checked as boolean;
402 this.value = value;
403 this.onchange(value);
404 }
405 }
406 setState(state: boolean) {
407 if (this.input) {
408 const checkbox = this.input.deref();
409 if (checkbox) {
410 checkbox.checked = state;
411 this.value = state;
412 }
413 }
414 }
415 onchange: (str: boolean) => void = (_) => {};
416 watchForChange(func: (str: boolean) => void) {
417 this.onchange = func;
418 }
419 submit() {
420 this.onSubmit(this.value);
421 }
422}
423
424class SubButtonInput implements OptionsElement<void> {
425 readonly owner: Options;
426 readonly onClick: (opt: Options) => void;
427 textContent: string;
428 value!: void;
429 opts?: {noSubmit?: boolean; ltr?: boolean; intText?: string};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected