UNPKG

owtlab-tracking

Version:
28 lines (22 loc) 591 B
export function getScreenProfile() { let keys; let output; if (typeof window === 'undefined' || !window.screen) return {}; keys = [ 'height', 'width', 'colorDepth', 'pixelDepth', 'availHeight', 'availWidth', ]; output = {}; for (let i = 0; i < keys.length; i++) { output[keys[i]] = window.screen[keys[i]] ? window.screen[keys[i]] : null; } output.orientation = { angle: window.screen.orientation ? window.screen.orientation.angle : 0, type: window.innerWidth > window.innerHeight ? 'landscape' : 'portrait', }; return output; }