WL 5.0.6.1 Android - Direct Update将Native / Cordova资源保持活动/内存中(例如BusyIndi​​cator),但引用丢失 [英] WL 5.0.6.1 Android - Direct Update keeps Native/Cordova resources active/in memory (e.g. BusyIndicator) but reference is lost

查看:138
本文介绍了WL 5.0.6.1 Android - Direct Update将Native / Cordova资源保持活动/内存中(例如BusyIndi​​cator),但引用丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们遇到以下问题:


  • 应用程式启动

  • 网络资源开始

  • 显示繁忙指示器(1)

  • 连接到WL服务器

  • <
  • 网络资源重新启动

  • 显示繁忙指示器(2)

  • li>
  • 成功

  • 载入并更改欢迎页面

  • 隐藏忙碌指标(2)

  • App Startup
  • Web Resources start
  • Show a Busy Indicator (1)
  • Connect to WL Server
  • Direct Update gets triggered
  • Web Resources restart
  • Show a Busy Indicator (2)
  • Connect to WL Server
  • Success
  • Load and change to welcome page
  • Hide Busy Indicator (2)

这样做的结果是,在直接更新的Web资源中,我们(当然)丢失/缺少对忙指示符(1)的引用,无法在触发直接更新后隐藏该指示器。那么,我们有两个指标(1)(2)打开,只有一个(2)关闭,旧的(1)永远开始。

This has the effect that in the direct-updated web resources we are (of course) loosing/missing the reference to the busy indicator (1) and we are not able to hide that indicator after the direct update was triggered. So then, we have two indicators (1) (2) open and only one (2) is closed, the old one (1) is up forever.

将是在直接更新被触发/执行之前得到一个事件...我们可以隐藏我们的指标(1)。这将变得非常类似于这个问题: IBM Worklight - 如何在更新应用程序之前执行JavaScript代码?

One solution would be to get an event before the direct update is triggered/executed ... there we could hide our indicator (1). This would then become quite similar to this question: IBM Worklight - How can I execute JavaScript code before updating the application?

更通用的方法是触发 app ...意思也重新启动本机shell和所有cordova资源。然后所有的本机资源,如忙指示符和其他东西应该删除和重置,是吗?

A more general approach would be to trigger a "deeper" restart of the app ... meaning to also restart the native shell and all cordova resources. Then all native resources like busy indicator and other things should be removed and reset, right?

有没有办法实现这样的深更新?这个问题是否已知?

Is there any way to achieve such a "deep" restart of the app after direct update? Is this problem known?

UPDATE 9月5日

以下事件在DirectUpdate重新启动Web资源前发生:

We saw that the following events are fired sometime before the DirectUpdate restarts the web resources:

window.addEventListener("beforeunload",
    function() { 
       WL.Logger.debug("busy test - unload2"); 
        app.busytest.hide();
            }
        , false);

window.addEventListener("unload",
    function() { 
       WL.Logger.debug("busy test - unload3"); 
         app.busytest.hide();
            }
        , false);

...但不幸的是,隐藏我们的WL.BusyIndi​​catorbusytest在这些事件中不再工作。

... but unfortunately hiding our WL.BusyIndicator "busytest" does not work in these events anymore. Does anyone have any ideas?

但是也许有一些其他清理代码可以放在DirectUpdate的情况下?

But maybe some other cleanup code could be placed there in case of a DirectUpdate?

推荐答案

繁忙指示器是一个单例。如果您创建几个繁忙的指标,显示它们,然后隐藏 - 所有将被隐藏。

Busy indicator is a singleton. If you create several busy indicators, show them and then hide of them - all will be hidden.

这篇关于WL 5.0.6.1 Android - Direct Update将Native / Cordova资源保持活动/内存中(例如BusyIndi​​cator),但引用丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆