windowHeight is unread

Hi,
when I use the following code, I get ‘windowHeight is unread’ warning

import wixWindow from ‘wix-window’;
$w.onReady(function () {
//TODO: write your page related code here…
wixWindow.getBoundingRect()
.then( (windowSizeInfo) => {
let windowHeight = windowSizeInfo.window.height; // 565
let windowWidth = windowSizeInfo.window.width; // 1269
let documentHeight = windowSizeInfo.document.height; // 780
let documentWidth = windowSizeInfo.document.width; // 1269
let scrollX = windowSizeInfo.scroll.x; // 0
let scrollY = windowSizeInfo.scroll.y; // 120
} );

});

can you help me please?

Hi Ghassan,

It’s only a warning, and it’s just telling you that you haven’t used the variable yet - that is, it’s “unread.”

So you seem to be good to go. Just use the variables that you set and the warning will go away.

Have fun,

Yisrael

Thank you very much
I want to display windowHeight and I added the following code but “text10” didn’t change
$w(‘#text10’).text=windowHeight;

Not exactly sure what the rest of your code looks like, but you might just need to do force windowHeight to be converted to a string, like this:

$w(’ #text10 ').text = " " + windowHeight;

I hope this helps,

Yisrael

thank you very much
it works now