Skip to content

Instantly share code, notes, and snippets.

@lucianobarauna
Created October 30, 2018 17:29
Show Gist options
  • Save lucianobarauna/ee387d9358020c09c8e2f5196d1c14f8 to your computer and use it in GitHub Desktop.
Save lucianobarauna/ee387d9358020c09c8e2f5196d1c14f8 to your computer and use it in GitHub Desktop.
debug-window
// https://codepen.io/lucianobarauna/pen/xyMXGw?editors=0010
// Um simples debug para visualizar as informações do objeto window.screen
(function(){
const $body = document.querySelector('body')
const objScreen = window.screen
// Create info
let createInfo = (prop, targetObj) => {
const $p = document.createElement('p')
$p.setAttribute('class', 'infodata')
$p.textContent += `${prop} : ${targetObj[prop]}`
return $p
}
// List content
let listContent = (obj) => {
let objTarget = obj
let $divContent = document.createElement('div')
$divContent.setAttribute('id', 'getinfopane')
for (var prop in objTarget) {
if(prop !== 'orientation'){
$divContent.appendChild(createInfo(prop, objTarget))
}
}
return $divContent
}
$body.appendChild(listContent(objScreen))
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment