Screen: change event
Window Management API
Window Management API
The change event of the Screen interface is fired on a specific screen when one or more of the following properties change on it:
- width
- height
- availWidth
- availHeight
- colorDepth
- orientation
Syntax
Use the event name in addEventListener():
addEventListener("change", (event) => { })
Alternatively, assign to the event handler property of the interface:
onchange = (event) => { }
Event type
A generic Event.
Examples
const firstScreen = (await window.getScreenDetails()).screens[0];
firstScreen.addEventListener("change", (event) => {
console.log("The first screen has changed.", event, firstScreen);
});