我无法删除我的PouchDB以重置我的jQuery Mobile应用程序。
(等效jsFiddle:http://jsfiddle.net/bYR8c/2/)
我在app.js
:
var db = new PouchDB('petrolog');
function resetDb(){
db.destroy(function(err, info) { console.log('Error: ' + err);
console.log('Info: ' + info); }); //this is line 38, referenced in errors below
showFillups(); //redraws the UI
}
和index.html
:
<head>
<script src="http://download.pouchdb.com/pouchdb-nightly.js"></script>
</head>
<body>
<a id="btnResetDb" class="ui-shadow ui-btn ui-corner-all">Erase all fillups</a>
<script> $('#btnResetDb').click(function(event){resetDb();}); </script>
</body>
当我点击按钮时,我从FireBug获得以下内容:
Error: null app.js (line 38)
Info: undefined app.js (line 38)
这些与[{1}}
中的db.destroy()
指令相对应
有什么建议吗?我已经在http://pouchdb.com/api.html#delete_database检查了API文档,但在那里找不到太多帮助。
答案 0 :(得分:1)
destroy()
方法实际上并没有为info
返回任何内容。 error
为空的事实表明一切都很成功。
这实际上是PouchDB文档中的一个错误,我们将修复它。
但是,FWIW,你的jsfiddle不能用于不相关的原因:小提琴环境似乎无法访问任何本地数据库,因此在Firefox中我看到Error: No valid adapter found
。