1. <small id='xTyps'></small><noframes id='xTyps'>

      • <bdo id='xTyps'></bdo><ul id='xTyps'></ul>

        <tfoot id='xTyps'></tfoot>
        <legend id='xTyps'><style id='xTyps'><dir id='xTyps'><q id='xTyps'></q></dir></style></legend>
      1. <i id='xTyps'><tr id='xTyps'><dt id='xTyps'><q id='xTyps'><span id='xTyps'><b id='xTyps'><form id='xTyps'><ins id='xTyps'></ins><ul id='xTyps'></ul><sub id='xTyps'></sub></form><legend id='xTyps'></legend><bdo id='xTyps'><pre id='xTyps'><center id='xTyps'></center></pre></bdo></b><th id='xTyps'></th></span></q></dt></tr></i><div id='xTyps'><tfoot id='xTyps'></tfoot><dl id='xTyps'><fieldset id='xTyps'></fieldset></dl></div>
      2. 如何判断 JS Windows8 Metro 应用程序是否可见

        时间:2023-09-30

          • <bdo id='FN6Ya'></bdo><ul id='FN6Ya'></ul>

            • <legend id='FN6Ya'><style id='FN6Ya'><dir id='FN6Ya'><q id='FN6Ya'></q></dir></style></legend>

              <tfoot id='FN6Ya'></tfoot>

                <small id='FN6Ya'></small><noframes id='FN6Ya'>

                1. <i id='FN6Ya'><tr id='FN6Ya'><dt id='FN6Ya'><q id='FN6Ya'><span id='FN6Ya'><b id='FN6Ya'><form id='FN6Ya'><ins id='FN6Ya'></ins><ul id='FN6Ya'></ul><sub id='FN6Ya'></sub></form><legend id='FN6Ya'></legend><bdo id='FN6Ya'><pre id='FN6Ya'><center id='FN6Ya'></center></pre></bdo></b><th id='FN6Ya'></th></span></q></dt></tr></i><div id='FN6Ya'><tfoot id='FN6Ya'></tfoot><dl id='FN6Ya'><fieldset id='FN6Ya'></fieldset></dl></div>
                    <tbody id='FN6Ya'></tbody>
                  本文介绍了如何判断 JS Windows8 Metro 应用程序是否可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试创建一个应用程序,该应用程序在可见时执行一些工作,而在它消失时执行其他工作.这通常通过页面可见性 api (http://css.dzone.com/articles/using-html5s-pagevisibility) 完成,但 Windows 8 目前不支持:http://msdn.microsoft.com/en-us/library/ie/hh673553(v=vs.85).aspx

                  有 onactivate 和 oncheckpoint 回调,但它们是针对流程生命周期的,不一定与应用可见性相关.具体来说,应用程序可以在暂停之前进入后台相当长的一段时间.

                  任何帮助将不胜感激.

                  -- 亨利

                  解决方案

                  我想你想要 visibilitychange 事件.请参阅Document 文档此处.更多关于应用程序生命周期事件的信息这里.p><块引用>

                  应用可见性

                  当用户从您的应用切换到另一个应用时,您的应用不再可见,但仍处于运行状态,直到Windows 可以暂停它(大约 10 秒).如果用户切换远离您的应用,但在 Windows 之前激活或切换回它可以暂停它,应用程序保持在运行状态.

                  您的应用没有当应用可见性改变时接收一个激活事件,因为应用程序仍在运行.Windows 只是简单地切换到应用程序和从应用程序切换为必要的.如果您的应用需要在用户切换时执行某些操作来回,它可以处理 VisibilityChanged |msvisibilitychange 事件.

                  可见性事件没有序列化恢复或激活事件.不要以为这些事件会来按特定顺序.

                  I am trying to create an app which does some work when it becomes visible, and does other work when it goes away. This is typically accomplished with the page visibility api (http://css.dzone.com/articles/using-html5s-pagevisibility) but this is not currently supported in windows 8: http://msdn.microsoft.com/en-us/library/ie/hh673553(v=vs.85).aspx

                  There are callbacks onactivated and oncheckpoint but these are for the process lifecycle and are not necessarily related to app visibility. Specifically, an app can go to the background for quite some time before it is suspended.

                  Any help would be appreciated.

                  -- Henry

                  解决方案

                  I think you want the visibilitychange event. See the Document documentation here. More on application lifecycle events here.

                  App visibility

                  When the user switches from your app to another app, your app is no longer visible but remains in the running state until Windows can suspend it (for about 10 seconds). If the user switches away from your app but activates or switches back to it before Windows can suspend it, the app remains in the running state.

                  Your app doesn't receive an activation event when app visibility changes, because the app is still running. Windows simply switches to and from the app as necessary. If your app needs to do something when the user switches away and back, it can handle the VisibilityChanged | msvisibilitychange event.

                  The visibility event is not serialized with the resume or activation events. Don't assume that these events come in a particular order.

                  这篇关于如何判断 JS Windows8 Metro 应用程序是否可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何识别用户代理是否是 Windows 8 平板电脑? 下一篇:在 Windows 8 中将用户重定向到桌面浏览器

                  相关文章

                  1. <i id='HLPBX'><tr id='HLPBX'><dt id='HLPBX'><q id='HLPBX'><span id='HLPBX'><b id='HLPBX'><form id='HLPBX'><ins id='HLPBX'></ins><ul id='HLPBX'></ul><sub id='HLPBX'></sub></form><legend id='HLPBX'></legend><bdo id='HLPBX'><pre id='HLPBX'><center id='HLPBX'></center></pre></bdo></b><th id='HLPBX'></th></span></q></dt></tr></i><div id='HLPBX'><tfoot id='HLPBX'></tfoot><dl id='HLPBX'><fieldset id='HLPBX'></fieldset></dl></div>
                    <legend id='HLPBX'><style id='HLPBX'><dir id='HLPBX'><q id='HLPBX'></q></dir></style></legend>

                      <tfoot id='HLPBX'></tfoot>

                        <bdo id='HLPBX'></bdo><ul id='HLPBX'></ul>
                    1. <small id='HLPBX'></small><noframes id='HLPBX'>