0
votes

I downloaded an MFP 6.3 sample project from below URL and migrated to MFP 8.0

https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/6.3/working-offline/working-offline/

function wlCommonInit(){    
    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(){
    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);
}

WL.Client.setHeartBeatInterval function is called. But WORKLIGHT_IS_CONNECTED, WORKLIGHT_IS_DISCONNECTED events not triggered in MFP 8.0.

Will WL.Client.setHeartBeatInterval is work or not?

1

1 Answers

0
votes

WL.Client.setHeartBeatInterval is valid as of MFP 8.0, and works well.API details here.

The events, however are not valid anymore. You can add your custom event listeners and check for connectivity.