Even if you clicked both buttons at the same time mousedown would be called for each button individually.
That's the thing though, that doesn't happen. If I click & hold the right mouse button, the left mousebutton will not trigger any further mousedown events and vice versa. Clicking both at the same time has the same issue since one of them is bound to be clicked first unless you happen to get it frameperfect maybe? It seems like this listener is only able to register one button at the same time which seems wrong to me.
You can’t directly query the state of a button with the browser so a solution is to just update some variables from mousedown and mouseup events, and then you can look at those variables to access the current button state.
That's what I'm going to do, but I'll use the mouse plugin for it, because that actually works as I expect it to. That's also what I'm already doing for the keyboard inputs, except I don't have to go through the keyboard plugin for that, I just do:
runtime.addEventListener("keydown", (ev) => this.keydown(ev));
runtime.addEventListener("keyup", (ev) => this.keyup(ev));
and it works. I'd actually prefer this method since it would work exactly the same. The mouse plugin only allows me to use isMouseButtonDown() which internally already tracks the state I suppose but makes it annoyingly inconsistent with how I handle the keyboard inputs. So I'd have to fire a customEvent to register onClick stuff.