using a varibale to point to a function (like a delegate in c sharp and javascript (I think)
I was just curious because I am currently doing Unity tutorial in c sharp at the same time.
We used a variable to hold "clickFunction.bind(this);"
Is that similar to a delegate in c sharp? Basically to use a variable to "point" to a function. That way, you can parse that variable to other functions as a parameter, and also makes code easier to read. I read that was great for checking for events on multiple objects for example. Sorry if this is not really a question for this forum.
var clickHandler = clickFunction.bind(this);
this.btn.addEventListener("click", clickHandler);
function clickFunction(event)
{
// implementation here
}
