What does this mean?

I don’t understand this code.

function onclose(func){
this.onclose_func = func;

Looks to me like it is taking a reference to a function as a parameter and then setting the this.onclose_func function to that function. What this probably means is the onclose function of object “this” is being overwritten such that when the onclose event is triggered it calls your reference function rather than the standard one.

That’s what I’m assuming but would need to do a little research to confirm.