fix(ssr): fix global window and document references (#17590)

This commit is contained in:
Adam Bradley
2019-02-22 20:13:09 -06:00
committed by GitHub
parent 6bea9d3248
commit 4646f53ec7
18 changed files with 76 additions and 70 deletions

View File

@ -14,6 +14,9 @@ export function matchBreakpoint(win: Window, breakpoint: string | undefined) {
if (breakpoint === undefined || breakpoint === '') {
return true;
}
const mediaQuery = SIZE_TO_MEDIA[breakpoint];
return win.matchMedia(mediaQuery).matches;
if ((win as any).matchMedia) {
const mediaQuery = SIZE_TO_MEDIA[breakpoint];
return win.matchMedia(mediaQuery).matches;
}
return false;
}