So I want to add a callback function to my other function, but the issue is since I want this code to be public, I want people to know what parameters to enter and what their types are.
I've tried to do it like Function<Event>
and Function(ev:Event)
, but neither have worked, instead, it comes off as any
.
This is my function:
/**
* Adds an event listener to track scroll events
* @param {void<Event>} callback
*/
static addScrollListener(callback) {
Input.scrollListeners.push(callback);
}
To be clear, by "summary" I'm referring to the description of the function.
This was solved by adding the parameters, with the type after a colon in brackets, (name:Type)
Example:
/**
* Adds an event listener to track scroll events
* @param {(ev:Event)} callback
*/
static addScrollListener(callback) {
Input.scrollListeners.push(callback);
}