update keyValueStore

This commit is contained in:
2017-08-16 18:25:45 +02:00
parent bb1293c764
commit 2ec33a118a
7 changed files with 111 additions and 75 deletions

View File

@ -65,15 +65,24 @@ export class KeyValueStore {
/**
* reads a keyValueFile from disk
*/
async read (keyArg: string) {
async readKey (keyArg: string) {
let data = await this.readAll()
return data[keyArg]
}
/**
* writes a key value file to disk
* writes a specific key to the keyValueStore
*/
async write (keyValueObject) {
async writeKey (keyArg: string, valueArg: any) {
let writeObject: any = {}
writeObject[keyArg] = valueArg
this.writeAll(writeObject)
}
/**
* writes all keyValue pairs in the object argument
*/
async writeAll (keyValueObject) {
plugins.smartlodash.merge(this.dataObject, keyValueObject)
this.syncTask.trigger()
}