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

Class SubButtonInput

src/webpage/settings.ts:357–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355 readonly text: string;
356 constructor(text: string) {
357 this.text = text;
358 }
359 generateHTML(): HTMLSpanElement {
360 const span = document.createElement("h2");
361 span.innerText = this.text;
362 return span;
363 }
364 watchForChange() {}
365 submit() {}
366}
367class CheckboxInput implements OptionsElement<boolean> {
368 readonly label: string;
369 readonly owner: Options;
370 readonly onSubmit: (str: boolean) => void;
371 value: boolean;
372 input!: WeakRef<HTMLInputElement>;
373 constructor(
374 label: string,
375 onSubmit: (str: boolean) => void,
376 owner: Options,
377 {initState = false} = {},
378 ) {
379 this.label = label;
380 this.value = initState;
381 this.owner = owner;
382 this.onSubmit = onSubmit;
383 }
384 generateHTML(): HTMLDivElement {
385 const div = document.createElement("div");
386 const span = document.createElement("span");
387 span.textContent = this.label;
388 div.append(span);
389 const input = document.createElement("input");
390 input.type = "checkbox";
391 input.checked = this.value;
392 input.oninput = this.onChange.bind(this);
393 this.input = new WeakRef(input);
394 div.append(input);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected