I was attempting to capture a simple right click event. However, when I do so, the event is firing 3 times for each click. I was able to reproduce this in the playground. If someone could tell me if this is a bug, or I did something wrong would be great.
Here’s the PG
look at the pinfo object, it has a different type in each
if you click and hold the mouse , you will see only type 1 event is sent
when you release you will see type 2 is sent
this obviously means it represents “mousedown” and “mouseup” events
if you dont hold the button down but rather do a regular click as you were doing , you get a third event aswell , with type 32 , this is obviously for a “click” event
so the 3 you see are “mousedown” , “mouseup” and “click”
so if you do not require granular knowledge of mousedown and mouseup for specific behaviour , then you should probably just filter your conditionals to check for type 32 , which is a click
(take note , the type property is at the root of the payload , not within the event property of the payload like the button property so :
pInfo.event.button = 0 ( left button )
pInfo.type = 32 ( click )
Excellent response! Thank you for taking the time to explain it in a manner that made perfect sense.