2022-05-29 02:58:42 +00:00
|
|
|
// 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() {
|
2022-05-29 02:58:42 +00:00
|
|
|
return (async () => {
|
|
|
|
return await storage.getItem('auto-update') || false;
|
|
|
|
})();
|
2020-10-26 16:06:00 +00:00
|
|
|
},
|
|
|
|
set autoUpdate(mode) {
|
2022-05-29 02:58:42 +00:00
|
|
|
storage.setItem('auto-update', mode);
|
2020-10-26 16:06:00 +00:00
|
|
|
},
|
2019-10-31 04:08:04 +00:00
|
|
|
get isOfflineMode() {
|
2022-05-29 02:58:42 +00:00
|
|
|
return (async () => {
|
|
|
|
return await storage.getItem('offline-mode') || false;
|
|
|
|
})();
|
2019-10-31 04:08:04 +00:00
|
|
|
},
|
|
|
|
set isOfflineMode(mode) {
|
2022-05-29 02:58:42 +00:00
|
|
|
storage.setItem('offline-mode', mode);
|
2019-10-31 04:08:04 +00:00
|
|
|
},
|
|
|
|
get offlineDocPath() {
|
2022-05-29 02:58:42 +00:00
|
|
|
return (async () => {
|
2022-07-05 05:13:03 +00:00
|
|
|
return await storage.getItem('offline-path') || '';
|
2022-05-29 02:58:42 +00:00
|
|
|
})();
|
2019-10-31 04:08:04 +00:00
|
|
|
},
|
|
|
|
set offlineDocPath(path) {
|
2022-05-29 02:58:42 +00:00
|
|
|
storage.setItem('offline-path', path);
|
2019-10-31 04:08:04 +00:00
|
|
|
},
|
2020-05-01 03:46:13 +00:00
|
|
|
get crateRegistry() {
|
2022-05-29 02:58:42 +00:00
|
|
|
return (async () => {
|
|
|
|
return await storage.getItem("crate-registry") || "crates.io";
|
|
|
|
})();
|
2020-05-01 03:46:13 +00:00
|
|
|
},
|
|
|
|
set crateRegistry(value) {
|
2022-05-29 02:58:42 +00:00
|
|
|
storage.setItem("crate-registry", value);
|
2020-05-01 03:46:13 +00:00
|
|
|
},
|
2022-01-23 15:51:45 +00:00
|
|
|
get defaultSearch() {
|
2022-05-29 02:58:42 +00:00
|
|
|
return (async () => {
|
|
|
|
return await storage.getItem("default-search") || {
|
|
|
|
thirdPartyDocs: false,
|
|
|
|
docsRs: true,
|
|
|
|
attributes: true
|
|
|
|
};
|
|
|
|
})();
|
2022-01-23 15:51:45 +00:00
|
|
|
},
|
|
|
|
set defaultSearch(value) {
|
2022-05-29 02:58:42 +00:00
|
|
|
storage.setItem("default-search", value);
|
2022-01-23 15:51:45 +00:00
|
|
|
}
|
2019-10-31 04:08:04 +00:00
|
|
|
};
|