mirror of
https://gitlab.com/Alamantus/Readlebee.git
synced 2025-07-11 18:45:56 +02:00
- Split initialization steps into their own files. - Use Choo routes instead of viewManager to properly set up 404 - Add styling for different colors of Picnic cards
32 lines
No EOL
1 KiB
JavaScript
32 lines
No EOL
1 KiB
JavaScript
export const appUtilities = (app) => {
|
|
app.getSettingsItem = settingsKey => {
|
|
let savedSettings = window.localStorage.getItem('settings');
|
|
if (savedSettings) {
|
|
savedSettings = JSON.parse(savedSettings);
|
|
if (typeof savedSettings[settingsKey] !== 'undefined') {
|
|
return savedSettings[settingsKey];
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
app.setSettingsItem = (settingsKey, value) => {
|
|
let savedSettings = window.localStorage.getItem('settings');
|
|
if (savedSettings) {
|
|
savedSettings = JSON.parse(savedSettings);
|
|
} else {
|
|
savedSettings = {};
|
|
}
|
|
savedSettings[settingsKey] = value;
|
|
return window.localStorage.setItem('settings', JSON.stringify(savedSettings));
|
|
}
|
|
app.getSessionState = () => {
|
|
let sessionState = window.sessionStorage.getItem('sessionState');
|
|
if (sessionState) {
|
|
return JSON.parse(sessionState);
|
|
}
|
|
return null;
|
|
}
|
|
app.setSessionState = () => {
|
|
return window.sessionStorage.setItem('sessionState', JSON.stringify(app.state));
|
|
}
|
|
} |