JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5864
  • Score
    100M100P100Q134248F
  • License MIT

Detect if DevTools is open

Package Exports

  • devtools-detect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (devtools-detect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

devtools-detect

Detect if DevTools is open

Useful for when you want something special to happen when DevTools is open. Like pausing canvas, adding style debug info, etc.

Demo

Install

$ npm install --save devtools-detect

Usage

<script src="node_modules/devtools-detect/index.js"></script>
<script>
    // check if it's open
    console.log('is DevTools open?', window.devtools.open);

    // get notified when it's opened/closed
    window.addEventListener('devtoolschange', function (e) {
        console.log('is DevTools open?', e.detail.open);
    });
</script>

Support

  • Chrome DevTools
  • Safari DevTools
  • Firefox DevTools
  • Firebug
  • Firebug Lite

Caveats

Doesn't work if DevTools is undocked and will show false positive if you toggle any kind of sidebar.

License

MIT © Sindre Sorhus