indexeddb

IndexedDB deleteDatabase does not reset version

喜夏-厌秋 提交于 2019-12-08 06:54:46
问题 In Firefox. Init (once) var r, dbname = 'a1', db = mozIndexedDB; First, try { r = db.open(dbname, 5); } catch (ex) { console.log(ex); } r.onupgradeneeded = r.onsuccess = r.onblocked = r.onerror = function (e) { console.log(e); }; you get two events fired as supposed to be. Then close the database, r.result.close() Finally, delete the database, try { r = db.deleteDatabase(dbname); } catch (ex) { console.log(ex); } r.onsuccess = r.onerror = r.onblocked = function (e) { console.log(e); };

Uncaught TypeError: Type error in Chrome when using indexedDB

狂风中的少年 提交于 2019-12-08 04:46:46
问题 I am trying to set up indexeddb storage for use in chrome. But am getting an Uncaught TypeError when I try to set up a READ_WRITE transaction. I have not been able to find good, up to date info on using webkitIDB. So I'm basically flying blind here. Any ideas what I've done wrong? Are there good tuts out there on this that I missed? Setup: function OfflineStorage() { this.saveJSONString = __bind(this.saveJSONString, this); var request, _this = this; this.dbkeyRange = window.webkitIDBKeyRange;

Indexeddb seems to not free memory

末鹿安然 提交于 2019-12-08 04:41:08
问题 I'm using localforage with its IndexedDB driver for storing simple key-value-pairs. But I encountered a problem when trying to remove or update values. Whenever I call localforage.removeItem("existingKey") or localforage.setItem("existingKey", "some value") with a key of an existing entry no memory is freed. When using WebSQL instead of IndexedDB the behavior does no occur. Example on JsBin (Only works in Chrome due to calls to navigator.storage ) 来源: https://stackoverflow.com/questions

Pull data from IndexedDB into array and output it via ReactJS

我的未来我决定 提交于 2019-12-08 04:30:36
问题 My actual Javascript code is the following: var schoolsData = new Array(); myDB.schools .each(function(school) { console.log('"' + school.title + '" wird auf den Array gepusht.'); schoolsData.push(new Array(school.title, schools.schoolnumber, school.address, school.principal, school.email, school.creationdate, school.lastupdate, school.comment)); }); var SchoolsRender = React.createClass({ render: function() { return ( <tr> {this.props.list.map(function(listValue){ return <td>{listValue}</td>

Indexeddb adds a new value instead of updating an existing value

╄→尐↘猪︶ㄣ 提交于 2019-12-07 18:12:35
问题 When attempting to update a record within indexeddb using the put method, it appears that a new value is created rather than a change. According to MDN this is the method to update a record, yet I'm not having the expected result. Any ideas? Here is my code example. /* @keys initalisation */ extension.onupgradeneeded = function (event) { database = event.target.result; if (!database.objectStoreNames.contains('profile')) { var _profile = database.createObjectStore('profile', { autoIncrement:

Is IndexedDB on Safari guaranteed to be persistent?

这一生的挚爱 提交于 2019-12-07 14:32:39
问题 Similar to this question, is IndexedDB guaranteed to be persistent ? ie. Safari will not reclaim disk space if the device is low on memory. 回答1: Safari have "No Eviction policy", meaning it will not automatically clean the IndexDB on low disk pressure, without user doing it manually. IndexDB is one of the fast evolving feature and you can expect to have a different eviction policy any time with no announcement. You should always build with fall back options. Chrome has explicit persistent

HTML5 Video from chunks saved in IndexedDB Chrome for Android

泄露秘密 提交于 2019-12-07 14:13:47
问题 I would like to use IndexedDB to store video files on client side for offline HTML5 app. To do so I download video in 2 chunks from server API. Then I store them in indexedDB as a blobs. Then on other page I get them from db and create new blob. Finally I create objectURL and assign it to video element as src. Code below show how I retrieve data and assign it to video element. I am using Dexie as a indexedDB wrapper. var db = new Dexie("database"); db.version(1).stores({ videos: 'id,videoData

Using webworker and IndexedDB for loader of Three js

寵の児 提交于 2019-12-07 05:09:46
问题 I want to use dracoLoader of threeJS in multi-threads, then I selected Webworker and IndexedDB. I have gotten the correct Geometry in webworker, however, when I pass data to main thread using IndexedDB, the geometry will be changed to a normal JS object instead of a ThreeJS Geometry. The geometry lost its functions and some information. webworker.js self.saveDrcToIndexedDB = function (drcfinal) { var db; var request = indexedDB.open("drcDB"); drcfinal.indexName = self.randomStr(); request

IndexedDB deleteDatabase does not reset version

孤人 提交于 2019-12-06 22:58:26
In Firefox. Init (once) var r, dbname = 'a1', db = mozIndexedDB; First, try { r = db.open(dbname, 5); } catch (ex) { console.log(ex); } r.onupgradeneeded = r.onsuccess = r.onblocked = r.onerror = function (e) { console.log(e); }; you get two events fired as supposed to be. Then close the database, r.result.close() Finally, delete the database, try { r = db.deleteDatabase(dbname); } catch (ex) { console.log(ex); } r.onsuccess = r.onerror = r.onblocked = function (e) { console.log(e); }; deletes successfully. However when I start running the first step scrip (opening db), 'onupgradeneeded' does

使用 HTML5 IndexedDB API

拟墨画扇 提交于 2019-12-06 22:48:04
HTML5 的一个重要特性是本地数据持久性,它使用户能够在线和离线访问 Web 应用程序。此外,本地数据持久性使移动应用程序更灵敏,使用的带宽更少,而且能够在低带宽场景中更高效地工作。HTML5 提供了一些本地数据持久性选项。第一个选项是 localstorage,它支持您使用一个简单的键值对来存储数据。IndexedDB(一个更加强大的选项)支持您本地存储大量对象,并使用健壮的数据访问机制检索数据。 IndexedDB API 取代了 Web Storage API,后者在 HTML5 规范中已不推荐使用。(但一些领先的浏览器仍然支持 Web Storage,其中包括苹果公司的 Safari 和 Opera Web 浏览器)与 Web Storage 相比,IndexedDB 具有多个优势,其中包括索引、事务处理和健壮的查询功能。本文将通过一系列的示例来展示如何管理 IndexedDB 数据库。(参见 下载 一节,获取示例的完整源代码。) 重要概念 一个网站可能有一个或多个 IndexedDB 数据库,每个数据库必须具有惟一的名称。 一个数据库可包含一个或多个对象存储。一个对象存储(由一个名称惟一标识)是一个记录集合。每个记录有一个键 和一个值。该值是一个对象,可拥有一个或多个属性。键可能基于某个键生成器,从一个键路径衍生出来,或者是显式设置。一个键生成器自动生成惟一的连续正整数