refactor to define helper service more accurately
This commit is contained in:
1 parent
5527acfb6a
commit
7618e4bf5d
28 files changed
+78
-403
No files matched your search
+4
-4
@@ -4,8 +4,8 @@ import {isPlatformBrowser} from '@angular/common';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DeviceDetectorService {
|
||||
isMobile: boolean = false;
|
||||
export class ViewportService {
|
||||
isNarrow: boolean = false;
|
||||
|
||||
constructor(@Inject(PLATFORM_ID) private platformId: Object) {
|
||||
this.updateDeviceType();
|
||||
@@ -16,9 +16,9 @@ export class DeviceDetectorService {
|
||||
|
||||
private updateDeviceType() {
|
||||
if (isPlatformBrowser(this.platformId)) {
|
||||
this.isMobile = window.innerWidth <= 768;
|
||||
this.isNarrow = window.innerWidth <= 768;
|
||||
} else {
|
||||
this.isMobile = false;
|
||||
this.isNarrow = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user