From 5ea708348962b927ea0474a2fa60784a11d7872d Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Thu, 3 Aug 2023 10:58:22 +1000 Subject: [PATCH] docs: fixup reporting bug --- demo/index.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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);