How can I detect a right-click on my UI button?

I have set up an inventory system and I’m now trying to detect a right mouse click on a UI button (new UI System). I’ve seen some answers here on the website but I can’t figure out how to do this in Javascript.
Would be awesome if somebody could help me.

button values are 0 for left button, 1 for right button, 2 for the middle button.