I saw in a javascript code written by a young guy this function
function foo(e:MouseEvent){
...
}
I want to know what does e:MouseEvent do?
I saw in a javascript code written by a young guy this function
function foo(e:MouseEvent){
...
}
Share Improve this question edited Jan 28, 2021 at 10:26 Mariksel Azemaj asked Jun 3, 2015 at 4:42 Mariksel AzemajMariksel Azemaj 5928 silver badges21 bronze badges 7 | Show 2 more commentsI want to know what does e:MouseEvent do?
1 Answer
Reset to default 23'e:MouseEvent' is a named parameter with a type declaration in typescript. A colon is used in typescript parameters to bind a parameter to a specific type which, in this case, is type 'MouseEvent'.
e is often used as the parameter name for a javascript event. Given the type it's likely a function that responds to a click event.
You can read more details about the syntax for it under the 'Function Types' heading of TypeScript's official documentation: https://www.typescriptlang.org/docs/handbook/functions.html.
MouseEvent
constructor. – Ram Commented Jun 3, 2015 at 4:51