From b4dd03ba2a2a38109afb242eb7b14b52f6e214ac Mon Sep 17 00:00:00 2001 From: JustAMacUser Date: Fri, 13 Dec 2019 13:39:52 -0500 Subject: [PATCH] Wrap AppBase.setupNightModeDetection() in try/catch because Safari doesn't support matchMedia change events. --- js/AppBase.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/AppBase.js b/js/AppBase.js index db524296c..a348c95f8 100644 --- a/js/AppBase.js +++ b/js/AppBase.js @@ -34,9 +34,11 @@ define(["dojo/_base/declare"], function (declare) { if (window.matchMedia) { const mql = window.matchMedia('(prefers-color-scheme: dark)'); - mql.addEventListener("change", () => { - this.nightModeChanged(mql.matches); - }); + try { + mql.addEventListener("change", () => { + this.nightModeChanged(mql.matches); + }); + } catch (e) {} this.nightModeChanged(mql.matches); }