diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-11-13 19:10:28 -0800 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-11-13 19:10:28 -0800 |
commit | a9fb56688434164e30f8f94868c652be7e7d69ad (patch) | |
tree | 42ce5def7b99441e676957ef8fbad3007fbf4bfa /ext/bg/js/database.js | |
parent | 1d29dd8ba765d7f7dfec69dfd783016c086989b3 (diff) |
WIP
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r-- | ext/bg/js/database.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index 5931e172..0621f1d6 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -39,6 +39,18 @@ class Database { return this.db.open(); } + purge() { + if (this.db === null) { + return Promise.reject('database not initialized'); + } + + this.db.close(); + return this.db.delete().then(() => { + this.db = null; + this.prepare(); + }); + } + findTerm(term, dictionaries) { if (this.db === null) { return Promise.reject('database not initialized'); |