Getting the cesium viewer window height/width

1. A concise explanation of the problem you're experiencing.

I would like to access the cesium viewer window height/width.

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

Right now, I am using:
    var windowHeight = \(window\)\.height\(\);     var windowWidth = (window).width();

But I don't think this works, and I'd rather look at it through Cesium.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I am trying to prevent a right click menu from going off screen, and in order to do that, I need readings of the cesium viewer window's height and width. How do I access them?

4. The Cesium version you're using, your operating system and browser.

Cesium 1.7.1, Rel7, Firefox

You can access the canvas via viewer.canvas. You can then get the width and height of that.

Note that the canvas has its own dimensions, accessed through canvas.width/canvas.height, and it might then be scaled up via CSS to get the final dimensions on the page.