1
0
Fork 0
mirror of https://gitlab.com/Alamantus/Readlebee.git synced 2025-03-24 20:30:45 +01:00
Readlebee/app/index.js
Robbie Antenesse b093595f1d Restructure app initiation
- 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
2019-09-25 12:32:52 -06:00

33 lines
805 B
JavaScript

import 'babel-polyfill';
import choo from 'choo';
import config from './config.json';
import { appRoutes } from './appRoutes';
import { appListeners } from './appListeners';
import { appState } from './appState.js';
import { appUtilities } from './appUtilities.js';
const app = choo();
if (process.env.NODE_ENV !== 'production') {
// Only runs in development and will be stripped from production build.
app.use(require('choo-devtools')()); // Exposes `choo` to the console for debugging!
}
app.use((state, emitter) => {
app.siteConfig = config;
appUtilities(app);
});
app.use((state, emitter) => {
appState(app, state);
// Listeners
appListeners(app, state, emitter);
});
// Routes
appRoutes(app);
app.mount('body'); // Overwrite the `<body>` tag with the content of the Choo app