]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/misc/screen.service.ts
Add ability to schedule video publication
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / misc / screen.service.ts
1 import { Injectable, NgZone } from '@angular/core'
2
3 @Injectable()
4 export class ScreenService {
5 private windowInnerWidth: number
6
7 constructor (private zone: NgZone) {
8 this.windowInnerWidth = window.innerWidth
9
10 // Try to cache a little bit window.innerWidth
11 this.zone.runOutsideAngular(() => {
12 setInterval(() => this.windowInnerWidth = window.innerWidth, 500)
13 })
14 }
15
16 isInSmallView () {
17 return this.windowInnerWidth < 600
18 }
19
20 isInMobileView () {
21 return this.windowInnerWidth < 500
22 }
23 }