Bugfix: Chrome storage user settings

This commit is contained in:
Nils Norman Haukås 2016-08-07 14:40:41 +02:00
parent 1dc2c1a247
commit 4dbb8458d5
2 changed files with 9 additions and 3 deletions

View file

@ -29,7 +29,7 @@ export class BackendService {
//alright let's make this query!
this.previousCall = word;
return this.$http.get(`${this.SettingsService.senseQueryUrl}/${word}`);
return this.$http.get(`${this.SettingsService.senseQueryUrl}/${word}`)
}
sendTaggedDataToServer(senseTag: ISenseTag) {

View file

@ -58,7 +58,11 @@ export class SettingsService {
}
const syncStorage = chrome.storage.sync
syncStorage.get(whatToFind, callback)
syncStorage.get(whatToFind, (loadedObject) => {
//the loadedObject can contain one or more loaded items.
//more info: https://developer.chrome.com/extensions/storage
callback(loadedObject[whatToFind]);
})
}
private saveSetting(nameOfThingToSave: string, valueToSave) {
@ -69,7 +73,9 @@ export class SettingsService {
}
const syncStorage = chrome.storage.sync
syncStorage.set({ nameOfThingToSave: valueToSave })
syncStorage.set({ nameOfThingToSave: valueToSave }, () => {
this.$log.debug('saveSetting successfully saved to chrome storage.')
})
}
get senseQueryUrl() {