various fixed to client rendering
parent
c1b0035d17
commit
369bcc070c
|
@ -1,23 +1,31 @@
|
||||||
import BrowserHistory from 'react-router/lib/BrowserHistory';
|
import Rx from 'rx';
|
||||||
|
import React from 'react';
|
||||||
|
import { Router } from 'react-router';
|
||||||
|
import { history } from 'react-router/lib/BrowserHistory';
|
||||||
import debugFactory from 'debug';
|
import debugFactory from 'debug';
|
||||||
import { Cat } from 'thundercats';
|
import { Cat } from 'thundercats';
|
||||||
|
|
||||||
import { app$ } from '../common/app';
|
import { app$ } from '../common/app';
|
||||||
|
|
||||||
const debug = debugFactory('fcc:client');
|
const debug = debugFactory('fcc:client');
|
||||||
const DOMContianer = document.getElemenetById('#fCC');
|
const DOMContianer = document.getElementById('fcc');
|
||||||
const fcc = new Cat();
|
const fcc = new Cat();
|
||||||
|
|
||||||
|
Rx.longStackSupport = !!debug.enabled;
|
||||||
|
|
||||||
// returns an observable
|
// returns an observable
|
||||||
app$(BrowserHistory)
|
app$(history)
|
||||||
.flatMap(app => {
|
.flatMap(([ initialState ]) => {
|
||||||
return fcc.render(app, DOMContianer);
|
return fcc.render(React.createElement(Router, initialState), DOMContianer);
|
||||||
})
|
})
|
||||||
.subscribe(
|
.subscribe(
|
||||||
function() {
|
() => {
|
||||||
debug('react rendered');
|
debug('react rendered');
|
||||||
},
|
},
|
||||||
function(err) {
|
err => {
|
||||||
debug('an error has occured', err.stack);
|
debug('an error has occured', err.stack);
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
debug('react closed subscription');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue