Created
December 4, 2023 23:07
-
-
Save ZachSaucier/ea8ebf65079febbde4f2f9190ae6644a to your computer and use it in GitHub Desktop.
devtools-detect console.info animation setup
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
<script type="module" defer> | |
import devtools from '/devtools-detect.js'; | |
const consoleInfoAnimation = () => { | |
// console.info animation here | |
}; | |
const handleDevtoolsChange = (e) => { | |
if (e.detail.isOpen) { | |
consoleInfoAnimation(); | |
window.removeEventListener('devtoolschange', handleDevtoolsChange); | |
} | |
}; | |
if (devtools.isOpen) { | |
consoleInfoAnimation(); | |
} else { | |
window.addEventListener('devtoolschange', handleDevtoolsChange); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment