@angular/cdk
Version:
Angular Material Component Development Kit
55 lines (52 loc) • 1.88 kB
JavaScript
import * as i0 from '@angular/core';
import { inject, PLATFORM_ID, Injectable } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
let hasV8BreakIterator;
try {
hasV8BreakIterator = typeof Intl !== 'undefined' && Intl.v8BreakIterator;
} catch {
hasV8BreakIterator = false;
}
class Platform {
_platformId = inject(PLATFORM_ID);
isBrowser = this._platformId ? isPlatformBrowser(this._platformId) : typeof document === 'object' && !!document;
EDGE = this.isBrowser && /(edge)/i.test(navigator.userAgent);
TRIDENT = this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);
BLINK = this.isBrowser && !!(window.chrome || hasV8BreakIterator) && typeof CSS !== 'undefined' && !this.EDGE && !this.TRIDENT;
WEBKIT = this.isBrowser && /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;
IOS = this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);
FIREFOX = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);
ANDROID = this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;
SAFARI = this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;
constructor() {}
static ɵfac = i0.ɵɵngDeclareFactory({
minVersion: "12.0.0",
version: "21.0.0",
ngImport: i0,
type: Platform,
deps: [],
target: i0.ɵɵFactoryTarget.Injectable
});
static ɵprov = i0.ɵɵngDeclareInjectable({
minVersion: "12.0.0",
version: "21.0.0",
ngImport: i0,
type: Platform,
providedIn: 'root'
});
}
i0.ɵɵngDeclareClassMetadata({
minVersion: "12.0.0",
version: "21.0.0",
ngImport: i0,
type: Platform,
decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}],
ctorParameters: () => []
});
export { Platform };
//# sourceMappingURL=_platform-chunk.mjs.map