23 lines
404 B
TypeScript
23 lines
404 B
TypeScript
![]() |
export enum DOMOrientationType
|
||
|
{
|
||
|
Portrait,
|
||
|
Landscape
|
||
|
}
|
||
|
|
||
|
export class DOMOrientation
|
||
|
{
|
||
|
static get type()
|
||
|
{
|
||
|
return this.isLandscape ? DOMOrientationType.Landscape : DOMOrientationType.Portrait;
|
||
|
}
|
||
|
|
||
|
static get isLandscape()
|
||
|
{
|
||
|
return window.innerWidth > window.innerHeight;
|
||
|
}
|
||
|
|
||
|
static get isPortrait()
|
||
|
{
|
||
|
return window.innerWidth < window.innerHeight;
|
||
|
}
|
||
|
}
|