inference-playground / src /lib /utils /template.ts
Nymbo's picture
Sync with upstream huggingface-projects/inference-playground (node 22, current Svelte app)
4e2820e verified
Raw History Blame Contribute Delete
464 Bytes
export function onchange(cb: (value: string, e: Event) => void): { onchange: (e: Event) => void } {
return {
onchange: (e: Event) => {
const el = e.target as HTMLInputElement;
if (!el) return;
cb(el.value, e);
},
};
}
export function oninput(cb: (value: string, e: Event) => void): { oninput: (e: Event) => void } {
return {
oninput: (e: Event) => {
const el = e.target as HTMLInputElement;
if (!el) return;
cb(el.value, e);
},
};
}