MobileFirst Platform Foundation 7.0 事件侦听器无法正常工作

MobileFirst Platform Foundation 7.0 event listeners not working properly

我将一个简单的混合 Worklight 项目从 6.3 升级到了 7.0。大多数功能都很好。但是,WL.Events.WORKLIGHT_IS_CONNECTED 和 WL.Events.WORKLIGHT_IS_DISCONNECTED 的监听​​器不再正常工作。

代码如下:

    function wlCommonInit(){

        WL.Client.connect({onSuccess: onConnectSuccess, onFailure: onConnectFailure});

        function onConnectSuccess() {
            WL.Logger.debug("Connect success.");
        }

        function onConnectFailure() {
            WL.Logger.debug("Connect failed.");
        }

        $("body").resize();

        //Added listeners for Online/Offline functionality and set heart beat
        document.addEventListener(WL.Events.WORKLIGHT_IS_CONNECTED, connectDetected, false); 
        document.addEventListener(WL.Events.WORKLIGHT_IS_DISCONNECTED, disconnectDetected , false);
        WL.Client.setHeartBeatInterval(10);

        initJson();
    }

// Online/Offline Functions
function connectionFailure(){
    alert("Could not connect to the MobileFirst Server.");
    var output = "OFFLINE";
    $('#ConnectionMsg').html(output);
}

function disconnectDetected(){
    var output = "<font color='red'>DISCONNECTED</font>";
    $('#ConnectionMsg').html(output);
}

function connectDetected(){
    var output = "<font color='green'>CONNECTED</font>";
    $('#ConnectionMsg').html(output);
    if(initialConnection){
        initialConnection = false;
    } else {
        setTimeout(function(){
            //cleanDirtyDocs();
        }, 20000);
    }
}

简单地说,应用程序有一个页脚,根据 WORKLIGHT_IS_CONNECTED 和 WORKLIGHT_IS_DISCONNECTED 事件显示 "CONNECTED" 或 "DISCONNECTED"。这在 WL6.3 中完美运行,但完全相同的代码在 7.0 中不起作用。初始化后没有消息,只有一个空白页脚,显示 DISCONNECT 的唯一方法是在服务器关闭后调用适配器。永远不会显示 CONNECT。

这毫无意义,而且很容易复制。这些事件的运作方式有变化吗?谢谢!

这是 MFP v7.0 版本的一个已知问题。计划发布 iFix 来解决它。目前没有解决方法。

请打开 PMR(支持票)以便将修复程序发送给您。
您可以提及 "APAR PI38012" 以便支持团队找到它。