Skip to content

Commit

Permalink
fix(useMediaQuery): check if window.matchMedia is a function (#1765)
Browse files Browse the repository at this point in the history
Co-authored-by: dfreier <stone_stabiler.0x@icloud.com>
  • Loading branch information
dfreier and dfreier committed Jul 6, 2022
1 parent 78a0af6 commit 60f9a1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/useMediaQuery/index.ts
Expand Up @@ -14,7 +14,7 @@ import { defaultWindow } from '../_configurable'
*/
export function useMediaQuery(query: string, options: ConfigurableWindow = {}) {
const { window = defaultWindow } = options
const isSupported = Boolean(window && 'matchMedia' in window && typeof 'matchMedia' === 'function')
const isSupported = Boolean(window && 'matchMedia' in window && typeof window!.matchMedia === 'function')

let mediaQuery: MediaQueryList | undefined
const matches = ref(false)
Expand Down

0 comments on commit 60f9a1a

Please sign in to comment.