rust-search-extension/extension/settings.js

48 lines
1.3 KiB
JavaScript
Raw Normal View History

// All getters are async getter, all setter are sync setter,
// we just ignore the set promise.
2019-10-31 04:08:04 +00:00
const settings = {
2020-10-26 16:06:00 +00:00
get autoUpdate() {
return (async () => {
return await storage.getItem('auto-update') || false;
})();
2020-10-26 16:06:00 +00:00
},
set autoUpdate(mode) {
storage.setItem('auto-update', mode);
2020-10-26 16:06:00 +00:00
},
2019-10-31 04:08:04 +00:00
get isOfflineMode() {
return (async () => {
return await storage.getItem('offline-mode') || false;
})();
2019-10-31 04:08:04 +00:00
},
set isOfflineMode(mode) {
storage.setItem('offline-mode', mode);
2019-10-31 04:08:04 +00:00
},
get offlineDocPath() {
return (async () => {
2022-07-05 05:13:03 +00:00
return await storage.getItem('offline-path') || '';
})();
2019-10-31 04:08:04 +00:00
},
set offlineDocPath(path) {
storage.setItem('offline-path', path);
2019-10-31 04:08:04 +00:00
},
2020-05-01 03:46:13 +00:00
get crateRegistry() {
return (async () => {
return await storage.getItem("crate-registry") || "crates.io";
})();
2020-05-01 03:46:13 +00:00
},
set crateRegistry(value) {
storage.setItem("crate-registry", value);
2020-05-01 03:46:13 +00:00
},
get defaultSearch() {
return (async () => {
return await storage.getItem("default-search") || {
thirdPartyDocs: false,
docsRs: true,
attributes: true
};
})();
},
set defaultSearch(value) {
storage.setItem("default-search", value);
}
2019-10-31 04:08:04 +00:00
};