2019-09-10 00:19:02 +02:00
|
|
|
import 'babel-polyfill';
|
|
|
|
|
2019-09-07 21:54:44 +02:00
|
|
|
import choo from 'choo';
|
|
|
|
|
2019-09-09 05:48:23 +02:00
|
|
|
import config from './config.json';
|
2019-09-25 20:32:52 +02:00
|
|
|
import { appRoutes } from './appRoutes';
|
|
|
|
import { appListeners } from './appListeners';
|
|
|
|
import { appState } from './appState.js';
|
|
|
|
import { appUtilities } from './appUtilities.js';
|
2019-09-07 21:54:44 +02:00
|
|
|
|
|
|
|
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!
|
|
|
|
}
|
|
|
|
|
2019-09-09 22:22:09 +02:00
|
|
|
app.use((state, emitter) => {
|
2019-09-25 20:32:52 +02:00
|
|
|
app.siteConfig = config;
|
|
|
|
appUtilities(app);
|
2019-09-09 22:22:09 +02:00
|
|
|
});
|
|
|
|
|
2019-09-07 21:54:44 +02:00
|
|
|
app.use((state, emitter) => {
|
2019-09-25 20:32:52 +02:00
|
|
|
appState(app, state);
|
2019-09-07 21:54:44 +02:00
|
|
|
|
|
|
|
// Listeners
|
2019-09-25 20:32:52 +02:00
|
|
|
appListeners(app, state, emitter);
|
2019-09-07 21:54:44 +02:00
|
|
|
});
|
|
|
|
|
2019-09-25 20:32:52 +02:00
|
|
|
// Routes
|
|
|
|
appRoutes(app);
|
2019-09-07 21:54:44 +02:00
|
|
|
|
2019-09-09 22:22:09 +02:00
|
|
|
app.mount('body'); // Overwrite the `<body>` tag with the content of the Choo app
|