How to get the rendered window size when directly using PlotlyJS

I am using Spencer Lyon’s PlotlyJS package as basis for an interactive data visualization tool. It is fantastic, but I am stuck on a particular issue: how to get the rendered size of the plot area (in pixels) when it is displayed either in Jupyter or Electron or anywhere else? So far I have tried size( p ) where p is the plot object - this returns (800,450) but this is clearly wrong because it is the same irrespective of where the plot is rendered and the rendered pixel size is bigger than 800x450. Also, when I call size( p ) after changing the window size with a mouse drag, I still get 800x450 so it is not updated back to Julia from the Java side of the activity. I have read somewhere in my search (lost the link) that using the Plotly package, which is closely related to PlotlyJS, one can keep track of the layout object used to create the plot and then query the width field. This is apparently updated after the rendering process. I have tried this for PlotlyJS, but couldn’t find a layout width property or key that can be read afterwards - only a width attribute when constructed. Lastly, I tried hooking onto the relayout event and digging into the returned data. All I got was “auto” instead of a useful value. None of the other published events look promising. Can somebody please point me in the right direction? Unfortunately I have no experience with Javascript so I cannot tackle the problem from that side.