[PWA] Check Online Status by using the NavigatorOnLine API

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[PWA] Check Online Status by using the NavigatorOnLine API相关的知识,希望对你有一定的参考价值。

Even if you have your application fully cached, you couldn’t perform any external request without internet connection. That’s why in order to build an offline-capable application, you must know when it’s actually offline.

This lesson shows you how to use the NavigatorOnLine API and online/offline events in order to disable the functionality to send messages of the application.

 

    this.online = navigator.onLine
    window.addEventListener(‘online‘, () => (this.online = true))
    window.addEventListener(‘offline‘, () => {
      this.online = false
    })

 

以上是关于[PWA] Check Online Status by using the NavigatorOnLine API的主要内容,如果未能解决你的问题,请参考以下文章

project online get approvals task data 获取审批待办任务接口

14 - How to check replication status

Check failed: status == CUBLAS_STATUS_SUCCESS (11 vs. 0) CUBLAS_STATUS_MAPPING_ERROR

c_cpp #Check Network Status.c

devtools::check - 系统命令“Rcmd.exe”失败,退出 status:1,stdout + stderr:

ORA-01122: database file 4 failed verification check