Well indeed it seems a bit odd at first sight, but I would say that there is nothing wrong. It is basically equivalent to having an argument as optional, except that the event handling mechanism forces you to define the event as first argument so you cannot make it optional.
To make it as close as possible to an optional argument, I would set the event as undefined
when calling it not as an event handler, since this is what the value would be if it was an optional argument. null
would also be OK I guess, but I think false
is semantically wrong: you want to say that there is no event, not that the event is false.
One way to make it maybe even cleaner would call it with an event argument made for the purpose. In your example, that would be:
overloadedHandler({currentTarget: obj.x}, obj);