Skip to content

Commit e436775

Browse files
timvdalenjelbourn
authored andcommitted
fix(platform): Remove assumption of `window' in MdPlatform (#2221)
Makes it work when loaded in node
1 parent a818579 commit e436775

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lib/core/platform/platform.ts

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ declare const window: any;
44

55
// Whether the current platform supports the V8 Break Iterator. The V8 check
66
// is necessary to detect all Blink based browsers.
7-
const hasV8BreakIterator = (window.Intl && (window.Intl as any).v8BreakIterator);
7+
const hasV8BreakIterator = typeof(window) !== 'undefined' ?
8+
(window.Intl && (window.Intl as any).v8BreakIterator) :
9+
(typeof(Intl) !== 'undefined' && (Intl as any).v8BreakIterator);
810

911
/**
1012
* Service to detect the current platform by comparing the userAgent strings and

0 commit comments

Comments
 (0)