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

Method constructor

src/webpage/settings.ts:923–992  ·  view source on GitHub ↗
(
		label: string,
		onSubmit: (str: FileList | null) => void,
		owner: Options,
		{clear = false, initImg = "", width = -1, objectFit = ""} = {},
	)

Source from the content-addressed store, hash-verified

921 this.onchange(emj);
922 this.owner.changed();
923 }
924 })();
925 };
926 div.append(label, emoji);
927 outDiv.append(div);
928 if (this.clear) {
929 const button = document.createElement("button");
930 button.textContent = I18n.settings.clear();
931 button.onclick = () => {
932 this.value = null;
933 emoji.remove();
934 this.onchange(null);
935 this.owner.changed();
936 emoji = document.createElement("span");
937 emoji.classList.add("emptyEmoji");
938 div.append(emoji);
939 };
940 outDiv.append(button);
941 }
942
943 return outDiv;
944 }
945 onchange = (_: Emoji | undefined | null) => {};
946 watchForChange(func: (arg1: Emoji | undefined | null) => void) {
947 this.onchange = func;
948 }
949 submit() {
950 this.onSubmit(this.value);
951 }
952}
953
954class FileInput implements OptionsElement<FileList | null | undefined> {
955 readonly label: string;
956 readonly owner: Options;
957 readonly onSubmit: (str: FileList | null) => void;
958 input!: WeakRef<HTMLInputElement>;
959 value: FileList | null | undefined = undefined;
960 clear: boolean;
961 constructor(
962 label: string,
963 onSubmit: (str: FileList | null) => void,
964 owner: Options,
965 {clear = false} = {},
966 ) {
967 this.label = label;
968 this.owner = owner;
969 this.onSubmit = onSubmit;
970 this.clear = clear;
971 }
972 generateHTML(): HTMLDivElement {
973 const div = document.createElement("div");
974 const span = document.createElement("span");
975 span.textContent = this.label;
976 div.append(span);
977 const innerDiv = document.createElement("div");
978 innerDiv.classList.add("flexltr", "fileinputdiv");
979 const input = document.createElement("input");
980 input.type = "file";

Callers

nothing calls this directly

Calls 3

clearMethod · 0.80
bindMethod · 0.45
changedMethod · 0.45

Tested by

no test coverage detected