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 { Cat } from 'thundercats';
|
||||
|
||||
import { app$ } from '../common/app';
|
||||
|
||||
const debug = debugFactory('fcc:client');
|
||||
const DOMContianer = document.getElemenetById('#fCC');
|
||||
const DOMContianer = document.getElementById('fcc');
|
||||
const fcc = new Cat();
|
||||
|
||||
Rx.longStackSupport = !!debug.enabled;
|
||||
|
||||
// returns an observable
|
||||
app$(BrowserHistory)
|
||||
.flatMap(app => {
|
||||
return fcc.render(app, DOMContianer);
|
||||
app$(history)
|
||||
.flatMap(([ initialState ]) => {
|
||||
return fcc.render(React.createElement(Router, initialState), DOMContianer);
|
||||
})
|
||||
.subscribe(
|
||||
function() {
|
||||
() => {
|
||||
debug('react rendered');
|
||||
},
|
||||
function(err) {
|
||||
err => {
|
||||
debug('an error has occured', err.stack);
|
||||
},
|
||||
() => {
|
||||
debug('react closed subscription');
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue