【文件属性】:
文件名称:devtools-detector:检测DevTools是否打开
文件大小:47KB
文件格式:ZIP
更新时间:2021-05-01 20:10:41
TypeScript
devtools检测器
安装
npm install devtools-detector --save
用法
ES6和TypeScript
import { addListener , launch } from 'devtools-detector' ;
const view = document . createElement ( 'div' ) ;
document . body . appendChild ( view ) ;
// 1. add listener
addListener (
isOpen =>
( view . innerText = isOpen
? 'devtools status: open'
: 'devtools status: close' )
) ;
// 2. launch detect
launch ( )
【文件预览】:
devtools-detector-master
----.gitignore(104B)
----README.MD(3KB)
----package.json(904B)
----tslint.json(2KB)
----package-lock.json(143KB)
----src()
--------devtools-checker()
--------utils()
--------index.ts(1KB)
--------detector.ts(2KB)
----webpack.config.js(675B)
----LICENSE(1KB)
----tsconfig.json(305B)
----example()
--------dev-test.html(412B)
--------promise-polyfill.js(7KB)
--------normal.html(1KB)
--------in-iframe.html(539B)
----.vscode()
--------settings.json(42B)
----.editorconfig(169B)
----.prettierrc(25B)