...
首页> 外文期刊>Net >BUILD A DATA-RICH PROGRESSIVE WEB APP
【24h】

BUILD A DATA-RICH PROGRESSIVE WEB APP

机译:建立一个数据丰富的渐进式Web应用程序

获取原文
获取原文并翻译 | 示例

摘要

In this tutorial, we'll use a contacts app as an example for how to implement offline data storage. We'll then look at using background sync to handle failed network requests and available methods to keep the user informed. For data-driven apps using a service worker, IndexedDB is great. We'll also use Dexie for IndexedDB's power in a promise-based interface. In order to keep the multiple JavaScript contexts in sync, we'll use a shared setup file for the database. In dexie-setup.js, we define the Object stores and versions we need. Let's add a new store for our app: const db = new Dexie('pwa-tutorial'); db.version(1).stores({ contacts: 'id, name, email, phone' }); We have one version to start but if we changed the data structure after launching the app, we'd want to add a new version with each new store, as well as an upgrade function. For now, adding the four columns to match our contacts data in db.json is fine.
机译:在本教程中,我们将使用联系人应用程序作为如何实现离线数据存储的示例。然后,我们将研究使用后台同步来处理失败的网络请求,以及可以使用户了解情况的可用方法。对于使用服务工作者的数据驱动的应用程序,IndexedDB很棒。我们还将在基于Promise的界面中将Dexie用于IndexedDB的功能。为了使多个JavaScript上下文保持同步,我们将为数据库使用一个共享的安装文件。在dexie-setup.js中,我们定义了所需的对象存储和版本。让我们为应用程序添加一个新商店:const db = new Dexie('pwa-tutorial'); db.version(1).stores({联系人:'id,姓名,电子邮件,电话'});我们有一个版本要启动,但是如果在启动应用程序后更改数据结构,我们希望为每个新商店添加一个新版本以及升级功能。现在,添加四列以匹配db.json中的联系人数据就可以了。

著录项

  • 来源
    《Net 》 |2019年第324期| 90-94| 共5页
  • 作者

    Michael Strutt;

  • 作者单位
  • 收录信息
  • 原文格式 PDF
  • 正文语种 eng
  • 中图分类
  • 关键词

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号