0
How To Determine What Arguments does a Callback Expect in JS ?
I was learning about Node and exploring the 'HTTP' module when I came across this member function called 'createServer,' which expects a callback function. The documentation has mentioned the following signature. http.createServer([options][, requestListener]) and requestListener has type of <function> so it effectively is a callback. My question is, provided the above definition, how do I know what arguments get passed to the callback requestListener? The documentation does mention the following fact as well, "The requestListener is a function which is automatically added to the 'request' event." but I cannot make anything out of it. Thanks.
1 Answer
0
Thanks for your response, but I think I failed to convey my actual point that Intellisense does not really give any information about the arguments that callback functions expect. So is there any way of determining those parameters without searching the internet? Is reading the source the last option in those cases? I hope it is not as vague now.