0
我的簡歷,就緒和暫停事件工作得很好。我在線/離線事件有問題。當我將設備置於飛行模式時,反之亦然。當我從互聯網斷開連接時,我沒有收到任何結果。這是我的代碼:在線/離線事件不在科爾多瓦開槍?
var app ={
initialize:function() {
this.bindEvents();
this.testzone = {};
},
bindEvents:function(){
document.addEventListener("deviceready", this.onDeviceReady,false);
document.addEventListener("pause", this.onPause,false);
document.addEventListener("resume", this.onResume,false);
},
onDeviceReady:function() {
document.addEventListener("online", this.onOnline,false);
document.addEventListener("offline", this.onOffline,false);
console.log("Readyii");
app.testzone = document.getElementById("test-zone");
app.testzone.innerHTML = "Readyii";
},
onPause: function() {
app.testzone.innerHTML += "<br />Paused";
},
onResume: function() {
app.testzone.innerHTML += "<br />Resumed";
},
onOnline: function() {
app.testzone.innerHTML += "<br />Online";
},
onOffline: function() {
app.testzone.innerHTML += "<br />Offline";
}
}
下面的代碼實際上是在bindEvents在第一,但我把它們裏面onDeviceReady:
document.addEventListener("online", this.onOnline,false);
document.addEventListener("offline", this.onOffline,false);