From 40a09d74125535ae380f319d019d2074526bda51 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sat, 2 May 2020 16:20:46 +0200 Subject: [PATCH] fixed ScreenDprListener never being fired --- src/browser/ScreenDprMonitor.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/browser/ScreenDprMonitor.ts b/src/browser/ScreenDprMonitor.ts index ec8c6d8a..6bd4857e 100644 --- a/src/browser/ScreenDprMonitor.ts +++ b/src/browser/ScreenDprMonitor.ts @@ -44,12 +44,14 @@ export class ScreenDprMonitor extends Disposable { } private _updateDpr(): void { - if (!this._resolutionMediaMatchList || !this._outerListener) { + if (!this._outerListener) { return; } // Clear listeners for old DPR - this._resolutionMediaMatchList.removeListener(this._outerListener); + if (this._resolutionMediaMatchList) { + this._resolutionMediaMatchList.removeListener(this._outerListener); + } // Add listeners for new DPR this._currentDevicePixelRatio = window.devicePixelRatio;