1
1
import { Injectable } from '@angular/core' ;
2
2
3
- declare const window : any ;
4
-
5
3
// Whether the current platform supports the V8 Break Iterator. The V8 check
6
4
// is necessary to detect all Blink based browsers.
7
- const hasV8BreakIterator = typeof ( window ) !== 'undefined' ?
8
- ( window . Intl && ( window . Intl as any ) . v8BreakIterator ) :
9
- ( typeof ( Intl ) !== 'undefined' && ( Intl as any ) . v8BreakIterator ) ;
5
+ const hasV8BreakIterator = ( typeof ( Intl ) !== 'undefined' && ( Intl as any ) . v8BreakIterator ) ;
10
6
11
7
/**
12
8
* Service to detect the current platform by comparing the userAgent strings and
@@ -22,14 +18,14 @@ export class Platform {
22
18
TRIDENT = / ( m s i e | t r i d e n t ) / i. test ( navigator . userAgent ) ;
23
19
24
20
// EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.
25
- BLINK = ! ! ( window . chrome || hasV8BreakIterator ) && ! ! CSS && ! this . EDGE && ! this . TRIDENT ;
21
+ BLINK = ! ! ( ( window as any ) . chrome || hasV8BreakIterator ) && ! ! CSS && ! this . EDGE && ! this . TRIDENT ;
26
22
27
23
// Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to
28
24
// ensure that Webkit runs standalone and is not used as another engine's base.
29
25
WEBKIT = / A p p l e W e b K i t / i. test ( navigator . userAgent ) && ! this . BLINK && ! this . EDGE && ! this . TRIDENT ;
30
26
31
27
/** Browsers and Platform Types */
32
- IOS = / i P a d | i P h o n e | i P o d / . test ( navigator . userAgent ) && ! window . MSStream ;
28
+ IOS = / i P a d | i P h o n e | i P o d / . test ( navigator . userAgent ) && ! ( window as any ) . MSStream ;
33
29
34
30
// It's difficult to detect the plain Gecko engine, because most of the browsers identify
35
31
// them self as Gecko-like browsers and modify the userAgent's according to that.
0 commit comments