mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 02:31:34 +08:00
Merge branch 'master' into update-pwa-check
This commit is contained in:
@ -98,8 +98,9 @@ export class Platform {
|
||||
* | phablet | on a phablet device. |
|
||||
* | tablet | on a tablet device. |
|
||||
* | electron | in Electron on a desktop device. |
|
||||
* | pwa | as a PWA app. |
|
||||
* | pwa | as a PWA app. |
|
||||
* | mobile | on a mobile device. |
|
||||
* | mobileweb | on a mobile device in a browser. |
|
||||
* | desktop | on a desktop device. |
|
||||
* | hybrid | is a cordova or capacitor app. |
|
||||
*
|
||||
|
@ -11,6 +11,7 @@ export const PLATFORMS_MAP = {
|
||||
'electron': isElectron,
|
||||
'pwa': isPWA,
|
||||
'mobile': isMobile,
|
||||
'mobileweb': isMobileWeb,
|
||||
'desktop': isDesktop,
|
||||
'hybrid': isHybrid
|
||||
};
|
||||
@ -37,6 +38,10 @@ export function setupPlatforms(win: any) {
|
||||
return platforms;
|
||||
}
|
||||
|
||||
function isMobileWeb(win: Window): boolean {
|
||||
return isMobile(win) && !isHybrid(win);
|
||||
}
|
||||
|
||||
function detectPlatforms(win: Window): string[] {
|
||||
return Object.keys(PLATFORMS_MAP).filter(p => (PLATFORMS_MAP as any)[p](win));
|
||||
}
|
||||
|
Reference in New Issue
Block a user