Mobilefirst 心跳示例。事件未触发

Mobilefirst heartbeat example. Events are not firing

我已经从下面link导入了示例。

https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/data/working-offline/

我在 wlCommonInit() 中添加了一个 WL.Client.connect()

当我启动应用程序时,控制流程按以下顺序进行。

WL.Logger.debug("I am inside the WL Common Init");  
Registeres the WL.Events.  
WL.Logger.debug("connectDetected called");  
WL.Logger.debug("Inside the connect-onSuccess");

但是调用setHeartBeatInterval()方法时。它没有再次调用 connectDetected() 方法?

有人可以帮我理解为什么它在调用 setHeartBeatInterval() 之后不调用 connectDetected() 方法吗?

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

    function onConnectSuccess() {
        WL.Logger.debug("Inside the connect-onSuccess");
    }

    function onConnectFailure() {
        WL.Logger.debug("Inside the connect-onFailure");
    }

    WL.Logger.debug("I am inside the WL Common Init");  

    document.addEventListener(WL.Events.WORKLIGHT_IS_CONNECTED, connectDetected, false); 
    document.addEventListener(WL.Events.WORKLIGHT_IS_DISCONNECTED, disconnectDetected , false);
}

 function connectionFailure(){
    alert("Could not connect to the MobileFirst Server.");
    var output = new Date() + "<hr />Working offline";
    $('#info').html(output); 
 }

 function disconnectDetected(){
    var output = new Date() + "<hr />disconnectDetected";
    $('#info').html(output);
 }

 function connectDetected(){
     WL.Logger.debug("connectDetected called");

     var output = new Date() + "<hr />connectDetected";
     $('#info').html(output);
 }

 function setHeartBeatInterval(interval){
    var output = new Date() + "<hr />heartbeat interval is set to: " + interval;
    $('#info').html(output);
    WL.Client.setHeartBeatInterval(interval);
 }

您希望它什么时候再次调用?
关闭服务器并重新启动它,它会检测到与服务器的连接,然后它会被调用。