Created
January 30, 2018 14:17
-
-
Save lethak/bad38cd5d31f08a5d772aed110665275 to your computer and use it in GitHub Desktop.
Detect if the browser devtool (console) is in use or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @returns bool whether the browser devtool is in use or not | |
*/ | |
exports.isDevtoolOpen = function () { | |
let isOpen | |
let element = new Audio() // does not shows unless verbose filter selected | |
Object.defineProperty(element, 'id', { | |
get: function () { | |
isOpen = true | |
return null | |
} | |
}) | |
isOpen = false | |
console.debug(element) | |
return isOpen | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment