ski*_*joe 13 windows indexeddb winjs windows-store-apps
我在Windows 8应用程序中使用IndexedDB,我对这两者都很新.我已经能够成功地创建,读取,更新,删除对象存储中的对象,并创建了几个数据库和一些对象存储.我的问题是如何列出我的所有对象存储和数据库?我创建了一些不需要的伪造的东西,我想稍微清理一下,但我不记得它们的名字.也许这是肛门保留,但似乎应该可以列出所有数据库和商店.谢谢!
Den*_*ski 18
编辑2018此答案不再适用:
webkitGetDatabaseNames() is deprecated in chrome 60
在Chrome webkit中有一个函数可以返回所有数据库名称,从Chrome 60(webkitgetdatabasenames)开始,此功能不再可用:
indexedDB.webkitGetDatabaseNames().onsuccess = function(sender,args)
{ console.log(sender.target.result); };
Run Code Online (Sandbox Code Playgroud)
还有另一个函数将所有对象存储列在一个可在所有浏览器中工作的数据库中:
indexedDB.open(databaseName).onsuccess = function(sender, args)
{ console.log(sender.target.result.objectStoreNames); };
Run Code Online (Sandbox Code Playgroud)
Use*_*ode 13
目前无法枚举标准中的现有数据库.Windows 8应用程序使用IE,它不提供非标准webkitGetDatabaseNames方法.您可以使用IE10中的选项对话框清除数据库.
使用IDBDatabase实例的objectStoreNames方法在标准中定义数据库中的商店列表.
mds*_*diq 12
At the time of writing this post [chrome 72], You can list all the databases using following command in console of the browser. Essentially indexedDB.databases() is a Promise. You can use it to get list of all databases as an array. Run a loop on the array to get the names of databases.
indexedDB.databases().then(r => console.log(r))
Run Code Online (Sandbox Code Playgroud)
Hope this helps
因为所有其他主题都作为重复项引用回此处。在 Chrome 中,您可以查看和删除所有在Developer Tools > Application > Storage.
查看 IndexedDB 内部结构:chrome://indexeddb-internals/
| 归档时间: |
|
| 查看次数: |
9119 次 |
| 最近记录: |