Add support function to reset the DB and a test that it works.
This commit is contained in:
parent
b6673511f7
commit
c7c58f8343
5 changed files with 41 additions and 2 deletions
|
@ -177,6 +177,21 @@ ZoteroContext.prototype = {
|
|||
}
|
||||
|
||||
return zContext;
|
||||
},
|
||||
|
||||
/**
|
||||
* Shuts down Zotero, calls a callback (that may return a promise),
|
||||
* then reinitializes Zotero. Returns a promise that is resolved
|
||||
* when this process completes.
|
||||
*/
|
||||
"reinit":function(cb, isConnector) {
|
||||
Services.obs.notifyObservers(zContext.Zotero, "zotero-before-reload", isConnector ? "connector" : "full");
|
||||
return zContext.Zotero.shutdown().then(function() {
|
||||
return cb ? cb() : false;
|
||||
}).finally(function() {
|
||||
makeZoteroContext(isConnector);
|
||||
zContext.Zotero.init(zInitOptions);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue