1
0
Fork 0

Upgrade Preferences class to handle external changes in storage

This commit is contained in:
Krzysztof Sikorski 2021-11-11 19:01:16 +01:00
parent 9d9b62c49d
commit ea29e3c2b0
Signed by: krzysztof-sikorski
GPG Key ID: 4EB564BD08FE8476
1 changed files with 13 additions and 0 deletions

View File

@ -66,4 +66,17 @@ class Preferences {
return storageSetter
}
listenForStorageChanges() {
browser.storage.onChanged.addListener((changes, areaName) => {
if ('sync' === areaName) {
if (Object.prototype.hasOwnProperty.call(changes, 'userAccessToken')) {
this.userAccessToken = changes.userAccessToken.newValue
}
if (Object.prototype.hasOwnProperty.call(changes, 'trackerSubmitUrl')) {
this.trackerSubmitUrl = changes.trackerSubmitUrl.newValue
}
}
})
}
}