mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 04:14:21 +08:00
fix(prerender): router compatible with prerender
This commit is contained in:
@ -35,7 +35,7 @@ export function isTablet(win: Window) {
|
||||
}
|
||||
|
||||
export function isDevice(win: Window) {
|
||||
return win.matchMedia('(any-pointer:coarse)').matches;
|
||||
return matchMedia(win, '(any-pointer:coarse)');
|
||||
}
|
||||
|
||||
export function isHybrid(win: Window) {
|
||||
@ -63,3 +63,9 @@ export function needInputShims(win: Window) {
|
||||
export function testUserAgent(win: Window, expr: RegExp) {
|
||||
return expr.test(win.navigator.userAgent);
|
||||
}
|
||||
|
||||
export function matchMedia(win: Window, query: string, fallback = false): boolean {
|
||||
return win.matchMedia
|
||||
? win.matchMedia(query).matches
|
||||
: fallback;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user