mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
use window matchMedia.
This commit is contained in:
parent
f9417db520
commit
9b851aac61
@ -89,7 +89,7 @@
|
|||||||
this.unsubscribePixelRatioChange()
|
this.unsubscribePixelRatioChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)
|
const media = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)
|
||||||
media.addEventListener('change', this.onPixelRatioChange)
|
media.addEventListener('change', this.onPixelRatioChange)
|
||||||
this.unsubscribePixelRatioChange = () => {
|
this.unsubscribePixelRatioChange = () => {
|
||||||
media.removeEventListener('change', this.onPixelRatioChange)
|
media.removeEventListener('change', this.onPixelRatioChange)
|
||||||
|
@ -249,9 +249,9 @@
|
|||||||
// check if the device has a touch screen
|
// check if the device has a touch screen
|
||||||
('ontouchstart' in window || navigator.maxTouchPoints > 0) &&
|
('ontouchstart' in window || navigator.maxTouchPoints > 0) &&
|
||||||
// we also check if the device has a pointer
|
// we also check if the device has a pointer
|
||||||
!matchMedia('(pointer:fine)').matches &&
|
!window.matchMedia('(pointer:fine)').matches &&
|
||||||
// and is capable of hover, then it probably has a mouse
|
// and is capable of hover, then it probably has a mouse
|
||||||
!matchMedia('(hover:hover)').matches
|
!window.matchMedia('(hover:hover)').matches
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@
|
|||||||
this.unsubscribePixelRatioChange()
|
this.unsubscribePixelRatioChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)
|
const media = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)
|
||||||
media.addEventListener('change', this.onPixelRatioChange)
|
media.addEventListener('change', this.onPixelRatioChange)
|
||||||
this.unsubscribePixelRatioChange = () => {
|
this.unsubscribePixelRatioChange = () => {
|
||||||
media.removeEventListener('change', this.onPixelRatioChange)
|
media.removeEventListener('change', this.onPixelRatioChange)
|
||||||
|
Loading…
Reference in New Issue
Block a user