onLine/offLine

属性

if (navigator.onLine) {
  alert('online')
} else {
  alert('offline')
}

监听方法

window.addEventListener("online", () => {
    that._fnNetworkHandler() ;
}, true)

window.addEventListener("offline", () => {
    that._fnNetworkHandler() ;
}, true)

results matching ""

    No results matching ""