feat: 0.2.3 - view version.md for details

This commit is contained in:
tackchen 2022-02-09 08:52:25 +08:00
parent 21d17b2d04
commit a36c93b064
17 changed files with 38 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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

File diff suppressed because one or more lines are too long

1
npm/index.d.ts vendored
View File

@ -11,6 +11,7 @@ declare interface optionStatic {
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
clearIntervalWhenDevOpenTrigger?: boolean; // 是否在触发之后停止监控
detectors: Array<DETECTOR_TYPE>; // 启用的监测器 默认为全部
clearLog?: boolean; // 是否每次都清除log
}
declare interface DDTStatic {
(option?: optionStatic): void;

View File

@ -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",

View File

@ -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",

View File

@ -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],
});

View File

@ -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
View File

@ -11,6 +11,7 @@ declare interface optionStatic {
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
clearIntervalWhenDevOpenTrigger?: boolean; // 是否在触发之后停止监控
detectors: Array<DETECTOR_TYPE>; // 启用的监测器 默认为全部
clearLog?: boolean; // 是否每次都清除log
}
declare interface DDTStatic {
(option?: optionStatic): void;

View File

@ -11,6 +11,7 @@ export const config = {
stopIntervalTime: 5000, // 在移动端时取消监视的等待时长
clearIntervalWhenDevOpenTrigger: false, // 是否在触发之后停止监控
detectors: 'all',
clearLog: true,
};
const MultiTypeKeys = ['detectors', 'ondevtoolclose'];

View File

@ -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();
}

View File

@ -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');

View File

@ -1 +1 @@
export default '0.2.2';
export default '0.2.3';