Allow .get/set/keys to return asynchronous results

This commit is contained in:
HirokiUchikawa
2018-06-01 11:44:45 +09:00
parent a835f9f0cb
commit 6e34f0697c
3 changed files with 56 additions and 5 deletions

View File

@@ -110,6 +110,18 @@ LocalFileSystem.prototype.keys = function(scope) {
return Object.keys(this.storages[scope].getData("/"));
}
LocalFileSystem.prototype.getAsync = function(scope, key) {
return when.resolve(this.get(scope, key));
};
LocalFileSystem.prototype.setAsync =function(scope, key, value) {
return when.resolve(this.set(scope, key, value));
};
LocalFileSystem.prototype.keysAsync = function(scope){
return when.resolve(this.keys(scope));
};
LocalFileSystem.prototype.delete = function(scope){
var self = this;
if(this.storages[scope]){