library-ts/browser/dom/DOMOrientation.ts

23 lines
404 B
TypeScript
Raw Normal View History

2025-03-25 06:42:27 +00:00
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;
}
}