I encountered a section of code within a custom component that is proving to be quite puzzling for me to comprehend.
public onTouch: () => void = () => {}
The function onTouch
is being assigned by the private method
registerOnTouch(fn: any) {
this.onTouch = fn;
}
My understanding is that the initial part public OnTouch: () = void
indicates a parameterless function that doesn't return anything. However, I am struggling to grasp the significance of the concluding part () => ()
.
Can someone clarify what the latter portion signifies? Could it potentially be an overload?