Skip to content

Instantly share code, notes, and snippets.

@pineoc
Created July 22, 2016 06:39
Show Gist options
  • Save pineoc/b1a96eea9b13a5b270b8b502a207e2df to your computer and use it in GitHub Desktop.
Save pineoc/b1a96eea9b13a5b270b8b502a207e2df to your computer and use it in GitHub Desktop.
How to check Developer tool window open
function isInspectOpen()
{
console.profile();
console.profileEnd();
if (console.clear) console.clear();
return console.profiles.length > 0;
}
window.onresize = function()
{
if ((window.outerHeight - window.innerHeight) > 100)
alert('Docked inspector was opened');
}
var checkStatus;
var element = new Image();
// var element = document.createElement('any');
element.__defineGetter__('id', function() {
checkStatus = 'on';
});
setInterval(function() {
checkStatus = 'off';
console.log(element);
console.clear();
document.querySelector('#devtool-status').innerHTML = checkStatus;
}, 1000)
var element = new Image();
Object.defineProperty(element, 'id', {
get: function () {
/* TODO */
alert('囧');
}
});
console.log('%cHello', element);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment