From 1119bac7fa60038a66cf14eb7c9ed96cd9428aa6 Mon Sep 17 00:00:00 2001 From: Tim van Dalen Date: Wed, 14 Dec 2016 21:57:49 +0100 Subject: [PATCH] fix(platform): Remove assumption of `window' in MdPlatform Makes it work when loaded in node --- src/lib/core/platform/platform.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 src/lib/core/platform/platform.ts diff --git a/src/lib/core/platform/platform.ts b/src/lib/core/platform/platform.ts old mode 100644 new mode 100755 index ade29058e1de..7e90e3cccf7e --- a/src/lib/core/platform/platform.ts +++ b/src/lib/core/platform/platform.ts @@ -4,7 +4,9 @@ declare const window: any; // Whether the current platform supports the V8 Break Iterator. The V8 check // is necessary to detect all Blink based browsers. -const hasV8BreakIterator = (window.Intl && (window.Intl as any).v8BreakIterator); +const hasV8BreakIterator = typeof(window) !== 'undefined' ? + (window.Intl && (window.Intl as any).v8BreakIterator) : + (typeof(Intl) !== 'undefined' && (Intl as any).v8BreakIterator); /** * Service to detect the current platform by comparing the userAgent strings and