File size: 464 Bytes
1778c9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
		},
	};
}