diff --git a/.babelrc b/.babelrc index 89d422c..d3390dc 100644 --- a/.babelrc +++ b/.babelrc @@ -12,5 +12,6 @@ "plugins": [ "@babel/plugin-syntax-dynamic-import", "@babel/plugin-proposal-object-rest-spread" + // "@babel/plugin-transform-runtime" // 不使用 async/await 是为了减少打包体积 ] } \ No newline at end of file diff --git a/README.cn.md b/README.cn.md index 5a625c0..cb44e3c 100644 --- a/README.cn.md +++ b/README.cn.md @@ -82,6 +82,7 @@ disable-devtool 可以禁用所有一切可以进入开发者工具的方法, 7. 使用极简、体积小巧 (仅7kb) 8. 支持npm引用和script标签引用(属性配置) 9. 识别真移动端与浏览器开发者工具设置插件伪造的移动端,为移动端节省性能 +10. 支持识别开发者工具关闭事件 ## 3. 使用 @@ -107,14 +108,15 @@ declare interface optionStatic { url?: string; // 关闭页面失败时的跳转页面,默认值为localhost tkName?: string; // 绕过禁用时的url参数名称,默认为 ddtk ondevtoolopen?(type: DetectorType, next: Function): void; // 开发者面板打开的回调,启用时url参数无效,type 为监测模式,详见3.5 + ondevtoolclose?(): void; interval?: number; // 定时器的时间间隔 默认200ms disableMenu?: boolean; // 是否禁用右键菜单 默认为true stopIntervalTime?: number; // 在移动端时取消监视的等待时长 - clearIntervalWhenDevOpenTrigger?: boolean; // 是否在触发之后停止监控 默认为false + clearIntervalWhenDevOpenTrigger?: boolean; // 是否在触发之后停止监控 默认为false, 在使用ondevtoolclose时该参数无效 detactors?: Array; // 启用的检测器 检测器详情见 3.5 默认为全部,建议使用全部 } -declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 4; // 检测器详情见 3.5 +declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 4 | 5; // 检测器详情见 3.5 ``` ### 3.2 md5 与 tk 绕过禁用 @@ -176,6 +178,7 @@ const DETECTOR_TYPE = { SIZE: 2, // 根据窗口尺寸检测 DATE_TO_STRING: 3, // 根据Date.toString 检测 FUNC_TO_STRING: 4, // 根据Function.toString 检测 + DEBUGGER: 5; // 根据断点检测,仅在ios chrome 真机情况下有效 } ``` diff --git a/README.md b/README.md index e0ed6c4..9fc67be 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ The library has the following features: 7. Minimal use, small size (only 7kb) 8. Support npm reference and script tag reference (attribute configuration) 9. Identify the real mobile terminal and browser developer tool settings plug-in forged mobile terminal, saving performance for the mobile terminal +10. Support for identifying developer tool shutdown events ## 3. Use @@ -106,13 +107,14 @@ declare interface optionStatic { url?: string; // Jump to the page when closing the page fails, the default value is localhost tkName?: string; // Bypass the url parameter name when disabled, the default is ddtk ondevtoolopen?(type: DetectorType, next: Function): void; // Callback for opening the developer panel, the url parameter is invalid when it is enabled, and the type is the monitoring mode, see 3.5 for details + ondevtoolclose?(): void; interval?: number; // Timer interval is 200ms by default 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 + clearIntervalWhenDevOpenTrigger?: boolean; // Whether to stop monitoring after triggering The default is false. This parameter is invalid when using ondevtoolclose detactors?: Array; // Enabled detectors For details of detectors, see 3.5. The default is all, it is recommended to use all } -declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 4; // For details of the detector, see 3.5 +declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 4 | 5; // For details of the detector, see 3.5 ``` ### 3.2 md5 and tk bypass disable @@ -174,6 +176,7 @@ const DETECTOR_TYPE = { SIZE: 2, // Detect according to window size DATE_TO_STRING: 3, // Check according to Date.toString FUNC_TO_STRING: 4, // Detect according to Function.toString + DEBUGGER: 5; // According to the breakpoint detection, it is only valid in the case of ios chrome real machine } ``` diff --git a/helper/version.en.md b/helper/version.en.md index efdb3f3..71d9f60 100644 --- a/helper/version.en.md +++ b/helper/version.en.md @@ -78,4 +78,10 @@ 1. Add the second parameter of config.ondevtoolopen next 2. Added shortcut key operations for prohibiting reviewing elements and saving web pages 3. Refactor the code -4. Fix the problem caused by the method on the console cannot be cached by ie \ No newline at end of file +4. Fix the problem caused by the method on the console cannot be cached by ie + +## 0.2.1 +1. Add ondevtoolclose configuration +2. Add isDevToolOpened api +3. Fix the accidental injury problem of ios mobile chrome +4. Added a debug page \ No newline at end of file diff --git a/helper/version.md b/helper/version.md index fc3a3db..e0ee143 100644 --- a/helper/version.md +++ b/helper/version.md @@ -79,4 +79,10 @@ 1. 增加 config.ondevtoolopen 第二个参数 next 2. 增加 禁止审查元素和保存网页的快捷键操作 3. 重构代码 -4. 修复ie不能缓存console上的方法导致的问题 \ No newline at end of file +4. 修复ie不能缓存console上的方法导致的问题 + +## 0.2.1 +1. 增加 ondevtoolclose 配置 +2. 增加 isDevToolOpened api +3. 修复 ios mobile chrome 的误伤问题 +4. 增加了一个debug页面 \ No newline at end of file diff --git a/index.html b/index.html index 1613986..28db517 100644 --- a/index.html +++ b/index.html @@ -120,6 +120,7 @@ disableDevtool(options);

url?: string; // Jump to the page when closing the page fails, the default value is localhost tkName?: string; // Bypass the url parameter name when disabled, the default is ddtk ondevtoolopen?(type: DetectorType): void; // Callback for opening the developer panel, the url parameter is invalid when it is enabled + ondevtoolclose?(): void; interval?: number; // Timer interval is 200ms by default disableMenu?: boolean; // Whether to disable the right-click menu The default is true stopIntervalTime?: number; // Waiting time to cancel monitoring on mobile @@ -127,7 +128,7 @@ disableDevtool(options);

detactors?: Array; // Enabled detectors For details of detectors, see 3.5. The default is all, it is recommended to use all } -declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3;

+declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3 | 4 | 5;

3.2 md5 and tk bypass disable

@@ -182,7 +183,7 @@ declare type DETECTOR_TYPE = -1 | 0 | 1 | 2 | 3;