1
0
mirror of https://github.com/uetchy/namae.git synced 2025-07-02 06:20:02 +09:00
namae/src/index.tsx

45 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-09-17 14:30:26 +09:00
import React from 'react';
import ReactDOM from 'react-dom';
2020-03-06 00:35:37 +09:00
import {Router} from 'react-router-dom';
2020-03-27 00:49:23 +09:00
import {StoreProvider} from 'easy-peasy';
2020-03-26 20:22:06 +09:00
import {createBrowserHistory} from 'history';
2019-09-17 14:30:26 +09:00
import App from './App';
import * as serviceWorker from './serviceWorker';
import {FullScreenSuspense} from './util/suspense';
2020-03-26 20:22:06 +09:00
import {wrapHistoryWithGA, initSentry} from './util/analytics';
import {initCrisp} from './util/crip';
2020-03-27 00:49:23 +09:00
import {compose} from './util/array';
import {store, wrapHistoryWithStoreHandler} from './store';
2019-09-17 14:30:26 +09:00
import './util/i18n';
2019-08-03 13:36:29 +09:00
2019-09-24 13:55:07 +09:00
initSentry();
initCrisp();
2019-09-24 13:55:07 +09:00
2020-03-27 00:49:23 +09:00
const history = compose(
createBrowserHistory(),
wrapHistoryWithStoreHandler,
wrapHistoryWithGA,
);
2020-03-06 00:35:37 +09:00
2019-09-24 13:55:07 +09:00
ReactDOM.render(
2020-03-26 20:22:06 +09:00
<StoreProvider store={store}>
<FullScreenSuspense>
<Router history={history}>
<App />
</Router>
</FullScreenSuspense>
</StoreProvider>,
2019-09-24 13:55:07 +09:00
document.getElementById('root'),
2019-09-17 14:30:26 +09:00
);
2019-08-01 01:10:09 +09:00
2020-03-06 23:45:55 +09:00
serviceWorker.register({
onUpdate: (registration) => {
console.log('New version available! Ready to update?');
if (registration && registration.waiting) {
registration.waiting.postMessage({type: 'SKIP_WAITING'});
}
window.location.reload();
},
});