小编Yur*_*iUn的帖子

DevTools 已与页面断开连接(错误:STATUS_BREAKPOINT)

关于问题

\n
    \n
  • 该问题会根据 2D 场景的大小在不同的随机时刻停止应用程序执行。
  • \n
  • 该问题停止了开发工具并且页面变成白色。
  • \n
  • 该问题不会在 DevTools 控制台中显示为错误或警告。
  • \n
  • 该问题仅出现在 Chrome 和 Edge 浏览器中。
  • \n
  • 在测试的前 4 天中,Chrome 和 Edge 浏览器中\xe2\x80\x99 并未出现该问题。
  • \n
\n

关于应用程序

\n

我制作了一个 JS6 应用程序来使用画布测试一些 2D 图形。只是纯 HTML、CSS 和 JavaScript。该应用程序应该在碰撞检测(使用 AABB 算法)、路径查找、碰撞物理和一些人工智能之后绘制场景和不同的几何图元。我使用 requestAnimationFrame(render) 方法来模拟动画渲染。所有代码都是基于 ECMAScript 6 中描述的 OOP 原则构建的。核心且非常简化的代码示例:

\n
class Scene{\n#vMap = [];\n\nconstructor(board){\n        this.canvas = document.getElementById(board);\n        this.ctx = this.canvas.getContext(\'2d\');\n        this.#createMap();\n        this.#createModels();\n\n        //etc.\n}\n\n#createMap(){//to do}\n\n#createModels(){//to do}\n\nrender(){\n        this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n        this.#vMap.forEach(obj =>{\n            obj.draw();\n           \n            if(obj.checkCollision(this.ball)){\n                this.ball.updateSpeedVector(obj);\n            }\n        });\n       \n        this.ball.draw();\n       \n        window.requestAnimationFrame(this.render.bind(this));\n}\n//\xe2\x80\xa6\n\nconst board …
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome google-chrome-devtools html5-canvas microsoft-edge

5
推荐指数
0
解决办法
4506
查看次数