Event types (MouseEvent, KeyboardEvent)
Në shqip: Tipet e ngjarjeve
ShpjegimiSQ
Çdo ngjarje ka tipin e vet: MouseEvent për klikime, KeyboardEvent për tastierën (me e.key), SubmitEvent për formularët. TypeScript-i e di vetë tipin kur përdor addEventListener("click", ...).
EnglishEN
Every event has its own type: MouseEvent for clicks, KeyboardEvent for the keyboard (with e.key), SubmitEvent for forms. TypeScript knows the type automatically when you use addEventListener("click", ...).
Si ta mendosh
Si zilet e ndryshme në shkollë: njëra për pushim, tjetra për zjarr — secila me kuptimin e vet.
Lexoje në anglisht
Like different bells at school: one for break, another for fire — each with its own meaning.
Shembull koditypescript
document.addEventListener("keydown", (e) => {
if (e.key === "/") e.preventDefault(); // e: KeyboardEvent
});