Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 1x 1x 1x 1x 1x 1x | function checkWindowAvailability() {
return typeof window === 'object';
}
export const IS_WINDOW_AVAILABLE = checkWindowAvailability();
function checkScreenOrientationAvailability() {
// W3C spec implementation
return (
IS_WINDOW_AVAILABLE &&
typeof window.ScreenOrientation === 'function' &&
typeof screen.orientation.addEventListener === 'function' &&
typeof screen.orientation.type === 'string'
);
}
export const IS_SCREEN_ORIENTATION_AVAILABLE = checkScreenOrientationAvailability();
export const ScreenOrientation = {
PORTRAIT_PRIMARY: 'portrait-primary',
PORTRAIT_SECONDARY: 'portrait-secondary',
LANDSCAPE_PRIMARY: 'landscape-primary',
LANDSCAPE_SECONDARY: 'landscape-secondary',
} as const;
export type ScreenOrientationType = (typeof ScreenOrientation)[keyof typeof ScreenOrientation];
export const AVAILABLE_SCREEN_ORIENTATIONS = Object.values(ScreenOrientation);
|