0

我无法删除我的 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)

这些对应于我db.destroy()resetDb()

有什么建议么?我已经在http://pouchdb.com/api.html#delete_database检查了 API 文档,但没有找到太多帮助。

4

1 回答 1

1

destroy()方法实际上并没有为info. 为空的事实error表明一切都成功了。

这实际上是 PouchDB 文档中的一个错误,我们将对其进行修复。

不过,FWIW,您的 jsfiddle 因不相关的原因无法工作:fiddle 环境似乎无法访问任何本地数据库,所以在 Firefox 中我看到了Error: No valid adapter found.

于 2014-04-17T22:25:28.800 回答