mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-28 05:08:00 +02:00
Preferences Improvements, Error Handling...
This commit is contained in:
parent
592ac8c470
commit
abcd8eb7b5
13 changed files with 285 additions and 133 deletions
|
@ -16,6 +16,7 @@ export function useSetupDB() {
|
|||
req.onerror = e => {
|
||||
console.log('Please let me use indexedDB!!');
|
||||
console.log(e);
|
||||
alert(e.target.error.message);
|
||||
};
|
||||
|
||||
req.onsuccess = e => {
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
export function usePrefs(key) {
|
||||
if (localStorage) {
|
||||
if (localStorage.get(key)) return true;
|
||||
else return false;
|
||||
} else return false;
|
||||
}
|
||||
export const useStore = () => {
|
||||
try {
|
||||
return window.localStorage;
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
|
||||
const error = i => {
|
||||
alert("Failed to Access '" + i + "' Please Enable localStorage.");
|
||||
};
|
||||
|
||||
return {
|
||||
getItem: error,
|
||||
setItem: error,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export function useLazyLoad() {
|
||||
let lazyElems;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue