I am making a 2d game using html5. I am rendering using a buffer and putImageData. Everything renders fine, for a few minutes. There is no problem with the frame rate and nothing pops up in the console.
我正在使用html5进行2D游戏。我正在使用缓冲区和putImageData进行渲染。一切都很好,几分钟。帧速率没有问题,控制台中没有弹出任何内容。
When I say the tab crashes, I am talking about an "Aw, Snap! Something went wrong while displaying this webpage." The javascript console says "DevTools was disconnected from the page. Once the page is reloaded, DevTools will automatically reconnect." Chrome does not mention any details about what is going wrong.
当我说标签崩溃时,我正在谈论一个“噢,Snap!显示这个网页时出了点问题。” javascript控制台说“DevTools与页面断开连接。重新加载页面后,DevTools将自动重新连接。” Chrome没有提及任何有关错误的细节。
If need be, I can link a copy of the source. I don't feel that it matters because this has been happening with many canvas projects of mine. The only thing that is similar between these projects is that I use the canvas 2d context and requestAnimationFrame.
如果需要,我可以链接源的副本。我觉得这不重要,因为我的许多帆布项目都在发生这种情况。这些项目之间唯一相似的是我使用canvas 2d上下文和requestAnimationFrame。
— EDIT —
- 编辑 -
I found a work-around. Using document.hidden
, I can decide to only render if the page is visible.
我找到了解决办法。使用document.hidden,我可以决定只在页面可见的情况下进行渲染。
1 个解决方案
#1
0
I found a work-around. Using document.hidden
, I can decide to only render if the page is visible.
我找到了解决办法。使用document.hidden,我可以决定只在页面可见的情况下进行渲染。
#1
0
I found a work-around. Using document.hidden
, I can decide to only render if the page is visible.
我找到了解决办法。使用document.hidden,我可以决定只在页面可见的情况下进行渲染。