How to use the pouchdb-browser.prototype function in pouchdb-browser

To help you get started, we’ve selected a few pouchdb-browser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EragonJ / Kaku / src / modules / Database.js View on Github external
let opt = {};

if (global && global.IS_TEST === true) {
  PouchDB.plugin(require('pouchdb-adapter-memory'));
  opt.adapter = 'memory';
}
else {
  opt.adapter = 'idb';
}

const KakuDB = new PouchDB('kaku', opt);

// Note:
// Because we add something new in the prototype chain and this is not safe,
// we added some prefix to make it unique
PouchDB.prototype.resetDatabase = function() {
  return this.destroy().catch((error) => {
    console.log('Something goes wrong when dropping database');
    console.log(error);
  });
};

module.exports = KakuDB;