mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Allow deleteTiddler to not modify fs (#6047)
* feat: allow deleteTiddler to not modify fs * refactor: add new function that merely delete file in cache, and let old func calls it * fix: self is undefined
This commit is contained in:
parent
7f1064d14b
commit
d14e775b90
@ -140,7 +140,7 @@ FileSystemAdaptor.prototype.deleteTiddler = function(title,callback,options) {
|
||||
}
|
||||
}
|
||||
// Remove the tiddler from self.boot.files & return null adaptorInfo
|
||||
delete self.boot.files[title];
|
||||
self.deleteTiddlerInCache(title);
|
||||
return callback(null,null);
|
||||
});
|
||||
} else {
|
||||
@ -148,6 +148,16 @@ FileSystemAdaptor.prototype.deleteTiddler = function(title,callback,options) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Delete a tiddler in cache, without modifying file system.
|
||||
*/
|
||||
FileSystemAdaptor.prototype.deleteTiddlerInCache = function(title) {
|
||||
// Only delete the tiddler if we have writable information for the file
|
||||
if(this.boot.files[title]) {
|
||||
delete this.boot.files[title];
|
||||
};
|
||||
};
|
||||
|
||||
if(fs) {
|
||||
exports.adaptorClass = FileSystemAdaptor;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user