作家
登录

客户端(浏览器端)数据存储技术概览

作者: 来源: 2017-04-07 09:19:38 阅读 我要评论

transaction.objectStore(dbStore); 
  •  
  •   
  •  
  •     // 3. Add the data to the store 
  •  
  •     store.put({ 
  •  
  •         name'Ire Aderinokun'
  •  
  •         age: 25 
  •  
  •     }); 
  •  
  •   
  •  
  •     // 4. Complete the transaction 
  •  
  •     return transaction.complete; 
  •  
  • }); 
  • 检索数据:

    1. // 1. Open up the database 
    2.  
    3. OpenIDB().then((db) => {   
    4.  
    5.     const dbStore = 'users'
    6.  
    7.   
    8.  
    9.     // 2. Open a new read-only transaction with the store within the database 
    10.  
    11.     const transaction = db.transaction(dbStore); 
    12.  
    13.     const store = transaction.objectStore(dbStore); 
    14.  
    15.   
    16.  
    17.     // 3. Return the data 
    18.  
    19.     return store.get('Ire Aderinokun'); 
    20.  
    21. }).then((item) => { 
    22.  
    23.     console.log(item); 
    24.  
    25. }) 

    删除数据:

    1. // 1. Open up the database 
    2.  
    3. OpenIDB().then((db) => {   
    4.  
    5.     const dbStore = 'users'
    6.  
    7.   
    8.  
    9.     // 2. Open a new read/write transaction with the store within the database

        推荐阅读

        军队创建干部健康体检信息管理新平台

      自本年4月起,全军各医疗机构将同一应用新版“部队干部健康体检信息治理体系”实施体检信息治理。记者获悉,该体检舷?容身部队医疗机构实际,为干部健康体检工作量身订制,是全>>>详细阅读


      本文标题:客户端(浏览器端)数据存储技术概览

      地址:http://www.17bianji.com/lsqh/34619.html

    关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)