diff --git a/angular/src/index.ts b/angular/src/index.ts index 46de9c00127..de9f90f2c12 100644 --- a/angular/src/index.ts +++ b/angular/src/index.ts @@ -40,7 +40,7 @@ export { IonicRouteStrategy } from './util/ionic-router-reuse-strategy'; export { IonicModule } from './ionic-module'; // UTILS -export { IonicSafeString } from '@ionic/core'; +export { IonicSafeString, getPlatforms, isPlatform } from '@ionic/core'; // CORE TYPES export { Animation, AnimationBuilder, AnimationCallbackOptions, AnimationDirection, AnimationFill, AnimationKeyFrames, AnimationLifecycle, Gesture, GestureConfig, GestureDetail, mdTransitionAnimation, iosTransitionAnimation } from '@ionic/core'; diff --git a/core/src/utils/platform.ts b/core/src/utils/platform.ts index bdb7f40cc89..516b23dae24 100644 --- a/core/src/utils/platform.ts +++ b/core/src/utils/platform.ts @@ -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;