noDebuger.js 549 B

1234567891011121314151617181920212223242526272829
  1. import deb from './noEdbuger_deb'
  2. export default function noDebuger() {
  3. function testDebuger() {
  4. var d = new Date()
  5. deb()
  6. if (new Date() - d > 100) {
  7. document.body.innerHTML = '<div>系统已经禁用该功能,请退出调试并刷新页面</div>'
  8. return true
  9. }
  10. return false
  11. }
  12. function start() {
  13. while (testDebuger()) {
  14. testDebuger()
  15. }
  16. }
  17. if (!testDebuger()) {
  18. window.onblur = function() {
  19. setTimeout(function() {
  20. start()
  21. }, 500)
  22. }
  23. } else {
  24. start()
  25. }
  26. }