Workshop › Breakout › Step 24 of 39
A click (or tap) on the canvas and the Space key both call the same launch function.
```js
canvas.addEventListener('pointerdown', launch)
document.addEventListener('keydown', (event) => {
if (event.key === ' ') launch()
})
```pointerdown fires when the canvas is clicked or touched. We pass launch itself (no ()), to be called then.keydown fires on the whole page when a key goes down; event.key is ' ' for Space.Write the lines right under the closing }) of the pointermove listener.
Skills: Keyboard and mouse input
← Launch the ball Remember which keys are held →