mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
feat(angular): expose getPlatforms and isPlatform (#21308)
This commit is contained in:
@ -6,7 +6,7 @@ interface IsPlatformSignature {
|
||||
(win: Window, plt: Platforms): boolean;
|
||||
}
|
||||
|
||||
export const getPlatforms = (win: any) => setupPlatforms(win);
|
||||
export const getPlatforms = (win?: any) => setupPlatforms(win);
|
||||
|
||||
export const isPlatform: IsPlatformSignature = (winOrPlatform: Window | Platforms | undefined, platform?: Platforms) => {
|
||||
if (typeof winOrPlatform === 'string') {
|
||||
@ -17,6 +17,8 @@ export const isPlatform: IsPlatformSignature = (winOrPlatform: Window | Platform
|
||||
};
|
||||
|
||||
export const setupPlatforms = (win: any = window) => {
|
||||
if (typeof win === 'undefined') { return []; }
|
||||
|
||||
win.Ionic = win.Ionic || {};
|
||||
|
||||
let platforms: Platforms[] | undefined | null = win.Ionic.platforms;
|
||||
|
||||
Reference in New Issue
Block a user