-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.jsx
37 lines (24 loc) · 813 Bytes
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*jshint -W018, -W040, -W064, -W083, -W086 */
import React from 'react';
import Router from 'react-router';
import Flux from './Flux.js';
import FluxComponent from 'flummox/component'
import routes from './routes.js';
import { performRouteHandlerStaticMethod } from './utils/Promise.js';
import 'babel/polyfill';
import FastClick from 'fastclick';
FastClick.attach(document.body);
export default function(divid) {
let flux = new Flux();
Router.run(routes, (Handler, state) => {
async function run() {
await performRouteHandlerStaticMethod(state.routes, 'routerWillRunOnClient', state, flux);
React.render(<FluxComponent
flux={flux}
render={() => <Handler />} />, document.getElementById(divid));
}
run().catch(error => {
throw error;
});
});
}