• [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
        })
  • 相关阅读:
    小 X 的密码破译
    时光机
    战争
    iOS TDD
    iOS url schemes应用


    二分查找
    搜索
    链表
  • 原文地址:https://www.cnblogs.com/Answer1215/p/9255725.html
Copyright © 2020-2023  润新知