several fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-11-10 21:04:20 +03:00
parent 52ccc121c9
commit 6de491a3fe
2 changed files with 7 additions and 7 deletions

View File

@ -76,12 +76,12 @@ object.Constructor('JournalDB', {
that.__db = req.result } }) }, that.__db = req.result } }) },
// XXX // XXX
get length(){ get length(){ return async function(){
return this.__promisify( return this.__promisify(
(await this.db) (await this.db)
.transaction('journal', 'readonly') .transaction('journal', 'readonly')
.objectStore('journal') .objectStore('journal')
.count()) }, .count()) }.call(this) },
slice: async function(from, to){ slice: async function(from, to){
return this.__promisify( return this.__promisify(
@ -299,7 +299,7 @@ module.BaseStore = {
var update = this.__names.options.update var update = this.__names.options.update
var index = {} var index = {}
for(var path of (await this.paths)){ for(var path of (await this.paths)){
index = update.call(this, index, name, path) } index = update.call(this, index, 'names', path) }
return index }, { return index }, {
update: async function(data, name, path){ update: async function(data, name, path){
data = await data data = await data
@ -372,7 +372,7 @@ module.BaseStore = {
var index = {tags: {}, paths: {}} var index = {tags: {}, paths: {}}
var update = this.__tags.options.update var update = this.__tags.options.update
for(var path of (await this.paths)){ for(var path of (await this.paths)){
index = update.call(this, index, name, path, await this.get(path)) } index = update.call(this, index, 'tags', path, await this.get(path)) }
return index } }, { return index } }, {
update: async function(data, name, path, update){ update: async function(data, name, path, update){
/*/ XXX CACHE_INDEX... /*/ XXX CACHE_INDEX...
@ -457,7 +457,7 @@ module.BaseStore = {
?? {}) ?? {})
var update = this.__search.options.update var update = this.__search.options.update
for(var path of (await this.paths)){ for(var path of (await this.paths)){
update.call(this, index, name, path, await this.get(path)) } update.call(this, index, 'search', path, await this.get(path)) }
return index } }, { return index } }, {
update: async function(data, name, path, update){ update: async function(data, name, path, update){
/*/ XXX CACHE_INDEX... /*/ XXX CACHE_INDEX...
@ -593,7 +593,7 @@ module.BaseStore = {
var path = this.__cache_path__ +'/'+ name+'_index' var path = this.__cache_path__ +'/'+ name+'_index'
data = (await this.get(path) ?? {}).index ?? [] } data = (await this.get(path) ?? {}).index ?? [] }
return data }, return data },
reset: function(){ reset: function(data, name){
this.__cache_path__ this.__cache_path__
&& this.delete(this.__cache_path__ +'/'+ name+'_index') }, }), && this.delete(this.__cache_path__ +'/'+ name+'_index') }, }),
journal: function(){ journal: function(){

View File

@ -18,7 +18,7 @@ var pouchdbstore = require('./pwiki/store/pouchdb')
var filestore = require('./pwiki/store/file') var filestore = require('./pwiki/store/file')
// XXX this fails silently in browser... // XXX this fails silently in browser...
var bootstrap = require('./bootstrap') //var bootstrap = require('./bootstrap')
//--------------------------------------------------------------------- //---------------------------------------------------------------------