From 1ef3e3dafe9528b2b8d6fa6741d476ff28a172fd Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Fri, 15 May 2020 10:49:15 -0400 Subject: [PATCH 1/3] Export utils --- angular/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'; From 2bd9310868d0d909e29c4c8537a304308a6c22d2 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Fri, 15 May 2020 11:42:01 -0400 Subject: [PATCH 2/3] Add ? check --- core/src/utils/platform.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/utils/platform.ts b/core/src/utils/platform.ts index bdb7f40cc89..b4769487bd5 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') { From ff7f47c7f31552afa1217d2e1cd4e109b97d48e1 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Fri, 22 May 2020 09:41:50 -0400 Subject: [PATCH 3/3] add SSR check --- core/src/utils/platform.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/utils/platform.ts b/core/src/utils/platform.ts index b4769487bd5..516b23dae24 100644 --- a/core/src/utils/platform.ts +++ b/core/src/utils/platform.ts @@ -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;