mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
Merge branch 'master' into update-pwa-check
This commit is contained in:
@ -100,6 +100,7 @@ export class Platform {
|
|||||||
* | 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. |
|
||||||
*
|
*
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user