diff --git a/demo/index.html b/demo/index.html index 1980f34..5de8d14 100644 --- a/demo/index.html +++ b/demo/index.html @@ -149,12 +149,14 @@

Screen Orientation Lock API Demo

const orientationQuery = window.matchMedia("(orientation: landscape)"); - orientationQuery.addEventListener("change", renderUpdate); - - screen.orientation?.addEventListener("change", () => { - log(`Orientation changed to "${orientation.type}".`, "event"); + const handleOrientationChange = () => { + log(`Orientation changed to "${screen.orientation?.type}".`, "event"); renderUpdate(); - }); + } + + orientationQuery.addEventListener("change", handleOrientationChange); + + screen.orientation?.addEventListener("change", handleOrientationChange); document.addEventListener("fullscreenchange", handleFullscreen); selector.addEventListener("input", lockOrientation);