@@ -14,25 +14,27 @@ export class Platform {
14
14
isBrowser : boolean = typeof document === 'object' && ! ! document ;
15
15
16
16
/** Layout Engines */
17
- EDGE = / ( e d g e ) / i. test ( navigator . userAgent ) ;
18
- TRIDENT = / ( m s i e | t r i d e n t ) / i. test ( navigator . userAgent ) ;
17
+ EDGE = this . isBrowser && / ( e d g e ) / i. test ( navigator . userAgent ) ;
18
+ TRIDENT = this . isBrowser && / ( m s i e | t r i d e n t ) / i. test ( navigator . userAgent ) ;
19
19
20
20
// EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.
21
- BLINK = ! ! ( ( window as any ) . chrome || hasV8BreakIterator ) && ! ! CSS && ! this . EDGE && ! this . TRIDENT ;
21
+ BLINK = this . isBrowser &&
22
+ ( ! ! ( ( window as any ) . chrome || hasV8BreakIterator ) && ! ! CSS && ! this . EDGE && ! this . TRIDENT ) ;
22
23
23
24
// Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to
24
25
// ensure that Webkit runs standalone and is not used as another engine's base.
25
- WEBKIT = / A p p l e W e b K i t / i. test ( navigator . userAgent ) && ! this . BLINK && ! this . EDGE && ! this . TRIDENT ;
26
+ WEBKIT = this . isBrowser &&
27
+ / A p p l e W e b K i t / i. test ( navigator . userAgent ) && ! this . BLINK && ! this . EDGE && ! this . TRIDENT ;
26
28
27
29
/** Browsers and Platform Types */
28
- IOS = / i P a d | i P h o n e | i P o d / . test ( navigator . userAgent ) && ! ( window as any ) . MSStream ;
30
+ IOS = this . isBrowser && / i P a d | i P h o n e | i P o d / . test ( navigator . userAgent ) && ! ( window as any ) . MSStream ;
29
31
30
32
// It's difficult to detect the plain Gecko engine, because most of the browsers identify
31
33
// them self as Gecko-like browsers and modify the userAgent's according to that.
32
34
// Since we only cover one explicit Firefox case, we can simply check for Firefox
33
35
// instead of having an unstable check for Gecko.
34
- FIREFOX = / ( f i r e f o x | m i n e f i e l d ) / i. test ( navigator . userAgent ) ;
36
+ FIREFOX = this . isBrowser && / ( f i r e f o x | m i n e f i e l d ) / i. test ( navigator . userAgent ) ;
35
37
36
38
// Trident on mobile adds the android platform to the userAgent to trick detections.
37
- ANDROID = / a n d r o i d / i. test ( navigator . userAgent ) && ! this . TRIDENT ;
39
+ ANDROID = this . isBrowser && / a n d r o i d / i. test ( navigator . userAgent ) && ! this . TRIDENT ;
38
40
}
0 commit comments