Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: get screen and window info #7

Closed
wants to merge 1 commit into from

Conversation

edvujic
Copy link
Contributor

@edvujic edvujic commented Jul 5, 2024

As part of WEBEX-379503

Add screen and window size reporting for MQRs

Description:
Used for MQRs report_intervalMetadata_screenResolution and report_intervalMetadata_appWindow(Height/Width/Size).

Screen size can be retrieved from the Screen API: https://developer.mozilla.org/en-US/docs/Web/API/Screen.
Window size can be retrieved from the Window API: https://developer.mozilla.org/en-US/docs/Web/API/Window.

@edvujic edvujic self-assigned this Jul 5, 2024
* @returns The width of the screen in pixels, or undefined if not available.
*/
static getScreenWidth(): number | undefined {
return window.screen.width;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window.screen.width and screen.width will produce the same result. Both properties access the width property of the global screen object.

though, when using only screen.width we get the following eslint problem // eslint-disable-next-line no-restricted-globals

it('returns the correct window width and height when accessed', () => {
expect.hasAssertions();

Object.defineProperty(window, 'innerWidth', {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

innerWidth and innerHeight do not have a get property, so they couldn't be spied on.

@edvujic edvujic closed this Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant