Skip to content

Commit

Permalink
fix: mediaQuery deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Dec 31, 2020
1 parent 95637c0 commit 3b6a0e7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/minimap-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -1147,13 +1147,12 @@ class MinimapElement {
* @access private
*/
subscribeToMediaQuery () {
const query = 'screen and (-webkit-min-device-pixel-ratio: 1.5)'
const mediaQuery = window.matchMedia(query)
const mediaListener = (e) => { this.requestForcedUpdate() }
mediaQuery.addListener(mediaListener)
const mediaQuery = window.matchMedia('screen and (-webkit-min-device-pixel-ratio: 1.5)')
const mediaListener = () => { this.requestForcedUpdate() }
mediaQuery.addEventListener('change', mediaListener)

return new Disposable(() => {
mediaQuery.removeListener(mediaListener)
mediaQuery.removeEventListener('change', mediaListener)
})
}

Expand Down

0 comments on commit 3b6a0e7

Please sign in to comment.