1
0
Fork 0
mirror of https://gitlab.com/Alamantus/Readlebee.git synced 2025-06-04 00:16:38 +02:00
Readlebee/app/appState.js
Robbie Antenesse 3bfaf5f3df Convert import/export to require/module.exports;Window conditions
Add conditions for whether to use certain things if run from server
2020-09-20 17:19:22 -06:00

15 lines
537 B
JavaScript

const { I18n } = require("./i18n");
const appState = (app, state, emitter) => {
state.events.SET_LANGUAGE = 'setLanguage';
state.events.ADD_TO_SHELF = 'addToShelf';
if (typeof window !== 'undefined') {
state.language = app.getSettingsItem('lang') ? app.getSettingsItem('lang') : (window.navigator.language || window.navigator.userLanguage).split('-')[0];
state.isLoggedIn = false;
state.i18n = new I18n(state); // Global I18n class passed to all views
}
state.viewStates = {};
}
module.exports = { appState };