I am trying to make an HTML5 game that as long as the player is pressing the LMB, the bullets keep spawning, and once LMB is released, the shooting stops. This is my function: 

```
document.onclick = function(mouse){ 
    console.log("Shoot");
}

```

Only once the LMB is released, that message is showing up in the console log. 
I did look over stackoverflow and found this:
[Qt mouseMoveEvent only when left mouse button is pressed](https://stackoverflow.com/questions/16279762/qt-mousemoveevent-only-when-left-mouse-button-is-pressed)
But I failed to integrate it into my canvas... it just won't do anything.
Thank you for your time.