长处,缺点和浏览器支撑
创建或者更新store中的数据:
和 Local Storage 一样
IndexedDB
IndexedDB 是一种更复杂和周全地客户端数据存储筹划,它是基于 JavaScript、面向对象的和数据库的,能异常轻易地存储数据和检索已经建立关键字索引的数据。
IndexedDB 的长处
- 可以或许处理更复杂和构造化的数据
- 每个’database’中可以有多个’databases’和’tables’
- 更大年夜的存储空间
- 对其有更多的交互控制
在构建渐进式Web应用一文中,我已经介绍了怎么应用 IndexedDB 来创建一个离线优先的应用。
浏览器支撑
IndexedDB 的根本 CRUD 操作
注:在示例中,我应用了 Jake’s Archibald 的 IndexedDB Promised library, 它供给了 Promise 风格的IndexedDB办法

- function OpenIDB() {
- return idb.open('SampleDB', 1, function(upgradeDb) {
- const users = upgradeDb.createObjectStore('users', {
- keyPath: 'name'
- });
- });
- }
- // 1. Open up the database
- OpenIDB().then((db) => {
- const dbStore = 'users';
- // 2. Open a new read/write transaction with the store within the database
- const transaction = db.transaction(dbStore, 'readwrite');
- const store =
推荐阅读
自本年4月起,全军各医疗机构将同一应用新版“部队干部健康体检信息治理体系”实施体检信息治理。记者获悉,该体检舷?容身部队医疗机构实际,为干部健康体检工作量身订制,是全>>>详细阅读
本文标题:客户端(浏览器端)数据存储技术概览
地址:http://www.17bianji.com/lsqh/34619.html
1/2 1

网友点评
精彩导读
科技快报
品牌展示