Merge branch 'master' into update-pwa-check

This commit is contained in:
Liam DeBeasi
2019-02-04 10:39:19 -05:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@ -98,8 +98,9 @@ export class Platform {
* | phablet | on a phablet device. | * | phablet | on a phablet device. |
* | tablet | on a tablet device. | * | tablet | on a tablet device. |
* | electron | in Electron on a desktop device. | * | electron | in Electron on a desktop device. |
* | pwa | as a PWA app. | * | pwa | as a PWA app. |
* | mobile | on a mobile device. | * | mobile | on a mobile device. |
* | mobileweb | on a mobile device in a browser. |
* | desktop | on a desktop device. | * | desktop | on a desktop device. |
* | hybrid | is a cordova or capacitor app. | * | hybrid | is a cordova or capacitor app. |
* *

View File

@ -11,6 +11,7 @@ export const PLATFORMS_MAP = {
'electron': isElectron, 'electron': isElectron,
'pwa': isPWA, 'pwa': isPWA,
'mobile': isMobile, 'mobile': isMobile,
'mobileweb': isMobileWeb,
'desktop': isDesktop, 'desktop': isDesktop,
'hybrid': isHybrid 'hybrid': isHybrid
}; };
@ -37,6 +38,10 @@ export function setupPlatforms(win: any) {
return platforms; return platforms;
} }
function isMobileWeb(win: Window): boolean {
return isMobile(win) && !isHybrid(win);
}
function detectPlatforms(win: Window): string[] { function detectPlatforms(win: Window): string[] {
return Object.keys(PLATFORMS_MAP).filter(p => (PLATFORMS_MAP as any)[p](win)); return Object.keys(PLATFORMS_MAP).filter(p => (PLATFORMS_MAP as any)[p](win));
} }