feat: 0.2.3 - view version.md for details
This commit is contained in:
parent
21d17b2d04
commit
a36c93b064
@ -114,6 +114,7 @@ declare interface optionStatic {
|
||||
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
|
||||
clearIntervalWhenDevOpenTrigger?: boolean; // 是否在触发之后停止监控 默认为false, 在使用ondevtoolclose时该参数无效
|
||||
detactors?: Array<DETECTOR_TYPE>; // 启用的检测器 检测器详情见 3.5 默认为全部,建议使用全部
|
||||
clearLog?: boolean; // 是否每次都清除log
|
||||
}
|
||||
|
||||
declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 4 | 5; // 检测器详情见 3.5
|
||||
|
@ -112,6 +112,7 @@ declare interface optionStatic {
|
||||
disableMenu?: boolean; // Whether to disable the right-click menu The default is true
|
||||
clearIntervalWhenDevOpenTrigger?: boolean; // Whether to stop monitoring after triggering The default is false. This parameter is invalid when using ondevtoolclose
|
||||
detactors?: Array<DETECTOR_TYPE>; // Enabled detectors For details of detectors, see 3.5. The default is all, it is recommended to use all
|
||||
clearLog?: boolean; // Whether to clear the log every time
|
||||
}
|
||||
|
||||
declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 4 | 5; // For details of the detector, see 3.5
|
||||
|
@ -84,4 +84,8 @@
|
||||
1. Add ondevtoolclose configuration
|
||||
2. Add isDevToolOpened api
|
||||
3. Fix the accidental injury problem of ios mobile chrome
|
||||
4. Added a debug page
|
||||
4. Added a debug page
|
||||
|
||||
## 0.2.3
|
||||
1. Opening the sidebar under edge will cause accidental injury, so disable sizeDetector under edge
|
||||
2. Increase the clearLog parameter to control whether the console is required for each situation, the default is true
|
@ -85,4 +85,8 @@
|
||||
1. 增加 ondevtoolclose 配置
|
||||
2. 增加 isDevToolOpened api
|
||||
3. 修复 ios mobile chrome 的误伤问题
|
||||
4. 增加了一个debug页面
|
||||
4. 增加了一个debug页面
|
||||
|
||||
## 0.2.3
|
||||
1. edge 下打开侧边栏会误伤,所以禁用edge下的sizeDetector
|
||||
2. 增加clearLog参数,控制是否需要每次情况控制台,默认为true
|
@ -183,7 +183,7 @@ declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 4 | 5;</code></p>
|
||||
<script
|
||||
disable-devtool-auto
|
||||
md5='1aabac6d068eef6a7bad3fdf50a05cc8'
|
||||
src='https://cdn.jsdelivr.net/npm/disable-devtool@0.2.2/disable-devtool.min.js#use'
|
||||
src='https://cdn.jsdelivr.net/npm/disable-devtool@0.2.3/disable-devtool.min.js#use'
|
||||
></script>
|
||||
<!-- <script disable-devtool-auto md5='1aabac6d068eef6a7bad3fdf50a05cc8' src='./npm/disable-devtool.min.js'></script> -->
|
||||
<script>
|
||||
|
@ -112,6 +112,7 @@ declare interface optionStatic {
|
||||
disableMenu?: boolean; // Whether to disable the right-click menu The default is true
|
||||
clearIntervalWhenDevOpenTrigger?: boolean; // Whether to stop monitoring after triggering The default is false. This parameter is invalid when using ondevtoolclose
|
||||
detactors?: Array<DETECTOR_TYPE>; // Enabled detectors For details of detectors, see 3.5. The default is all, it is recommended to use all
|
||||
clearLog?: boolean; // Whether to clear the log every time
|
||||
}
|
||||
|
||||
declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 4 | 5; // For details of the detector, see 3.5
|
||||
|
2
npm/disable-devtool.min.js
vendored
2
npm/disable-devtool.min.js
vendored
File diff suppressed because one or more lines are too long
1
npm/index.d.ts
vendored
1
npm/index.d.ts
vendored
@ -11,6 +11,7 @@ declare interface optionStatic {
|
||||
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
|
||||
clearIntervalWhenDevOpenTrigger?: boolean; // 是否在触发之后停止监控
|
||||
detectors: Array<DETECTOR_TYPE>; // 启用的监测器 默认为全部
|
||||
clearLog?: boolean; // 是否每次都清除log
|
||||
}
|
||||
declare interface DDTStatic {
|
||||
(option?: optionStatic): void;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "disable-devtool",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"description": "Disable web developer tools from the f12 button, right-click and browser ",
|
||||
"main": "disable-devtool.min.js",
|
||||
"unpkg": "disable-devtool.min.js",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "disable-devtool",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"description": "Disable web developer tools from the f12 button, right-click and browser ",
|
||||
"main": "disable-devtool.min.js",
|
||||
"unpkg": "disable-devtool.min.js",
|
||||
|
@ -22,6 +22,7 @@ disableDevtool({
|
||||
interval: 1000,
|
||||
// tkName: 'ddtk',
|
||||
disableMenu: false,
|
||||
clearLog: false,
|
||||
// url: 'https://www.baidu.com'
|
||||
// detectors: [disableDevtool.DETECTOR_TYPE.DATE_TO_STRING],
|
||||
});
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
import {clearDevToolOpenState} from '../utils/open-state';
|
||||
import {isInIframe} from '../utils/util';
|
||||
import {isEdge, isInIframe} from '../utils/util';
|
||||
import {DETECTOR_TYPE, triggerOnDevOpen} from './detector';
|
||||
|
||||
function checkWindowSizeUneven () {
|
||||
@ -46,6 +46,10 @@ export default function detector () {
|
||||
console.warn('SizeDetector is disabled in IFrame');
|
||||
return;
|
||||
}
|
||||
if (isEdge) {
|
||||
console.warn('SizeDetector is disabled in Edge');
|
||||
return;
|
||||
}
|
||||
checkWindowSizeUneven();
|
||||
window.addEventListener('resize', () => {
|
||||
setTimeout(checkWindowSizeUneven, 100);
|
||||
|
1
src/index.d.ts
vendored
1
src/index.d.ts
vendored
@ -11,6 +11,7 @@ declare interface optionStatic {
|
||||
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
|
||||
clearIntervalWhenDevOpenTrigger?: boolean; // 是否在触发之后停止监控
|
||||
detectors: Array<DETECTOR_TYPE>; // 启用的监测器 默认为全部
|
||||
clearLog?: boolean; // 是否每次都清除log
|
||||
}
|
||||
declare interface DDTStatic {
|
||||
(option?: optionStatic): void;
|
||||
|
@ -11,6 +11,7 @@ export const config = {
|
||||
stopIntervalTime: 5000, // 在移动端时取消监视的等待时长
|
||||
clearIntervalWhenDevOpenTrigger: false, // 是否在触发之后停止监控
|
||||
detectors: 'all',
|
||||
clearLog: true,
|
||||
};
|
||||
|
||||
const MultiTypeKeys = ['detectors', 'ondevtoolclose'];
|
||||
|
@ -2,9 +2,10 @@
|
||||
* @Author: tackchen
|
||||
* @Date: 2021-12-24 13:18:23
|
||||
* @LastEditors: tackchen
|
||||
* @FilePath: /disable-devtool/src/log.js
|
||||
* @FilePath: /disable-devtool/src/utils/log.js
|
||||
* @Description: Coding something
|
||||
*/
|
||||
import {config} from './config';
|
||||
import {isIE} from './util';
|
||||
|
||||
const console = window.console || {
|
||||
@ -18,7 +19,12 @@ export const log = (() => {
|
||||
return isIE ? ((...args) => {return console.log(...args);}) : console.log;
|
||||
})();
|
||||
|
||||
export const clearLog = (() => {
|
||||
const clearLogFunc = (() => {
|
||||
// ie 不支持缓存使用 log等方法
|
||||
return isIE ? (() => {return console.clear();}) : console.clear;
|
||||
})();
|
||||
|
||||
export function clearLog () {
|
||||
if (config.clearLog)
|
||||
clearLogFunc();
|
||||
}
|
||||
|
@ -107,7 +107,9 @@ export const isFirefox = hasUaName('firefox');
|
||||
|
||||
export const isMacOs = hasUaName('macintosh');
|
||||
|
||||
export const isOldEdge = hasUaName('edge') && !hasUaName('chrome');
|
||||
export const isEdge = hasUaName('edge');
|
||||
|
||||
export const isOldEdge = isEdge && !hasUaName('chrome');
|
||||
|
||||
export const isIE = isOldEdge || hasUaName('trident') || hasUaName('msie');
|
||||
|
||||
|
@ -1 +1 @@
|
||||
export default '0.2.2';
|
||||
export default '0.2.3';
|
Loading…
x
Reference in New Issue
Block a user