-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matthew Dressman
committed
Mar 11, 2015
1 parent
e66b277
commit b813eef
Showing
14 changed files
with
211 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
'use strict'; | ||
var React = require('react'); | ||
var FluxibleApp = require('fluxible'); | ||
var Fluxible = require('fluxible'); | ||
var fetchrPlugin = require('fluxible-plugin-fetchr'); | ||
var routrPlugin = require('fluxible-plugin-routr'); | ||
|
||
/* | ||
* This is our porch global flux app. It registers all of our pages, stores, | ||
* and handles the basic routing and page loading. | ||
*/ | ||
var app = new FluxibleApp({ | ||
* Common application setup code. | ||
* | ||
* - Create new Fluxible app instance | ||
* - Define root application component | ||
* - Install plugins | ||
* - Register stores | ||
*/ | ||
|
||
var app = new Fluxible({ | ||
component: React.createFactory(require('./pages/homepage/home-page')) | ||
}); | ||
|
||
app.plug(fetchrPlugin({ | ||
xhrPath: '/napi/' | ||
})); | ||
app.plug(fetchrPlugin()); | ||
|
||
app.plug(routrPlugin({ | ||
routes: require('./routes') | ||
})); | ||
app.plug(routrPlugin({ routes: require('./routes') })); | ||
|
||
// Register required stores | ||
app.registerStore(require('../src/stores/project-store')); | ||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
'use strict'; | ||
|
||
var app = require('./app'); | ||
|
||
var React = require('react'); | ||
var dehydratedState = window.App; // sent from the server | ||
window.React = React; // for chrome dev tool support | ||
window.React = React; // for Chrome DevTools support | ||
|
||
/* | ||
* Grab dehydrated application state from all stores. | ||
* Sent from the server | ||
*/ | ||
var dehydratedState = window.App; | ||
|
||
/* | ||
* Re-initialize application state and provides the request's | ||
* context object to the callback | ||
*/ | ||
app.rehydrate(dehydratedState, function (err, context) { | ||
if (err) { | ||
throw err; | ||
} | ||
window.context = context; | ||
|
||
window.context = context; | ||
var mountNode = document.getElementById('app'); | ||
var Component = app.getComponent(); | ||
|
||
React.render(app.getComponent()({context: context.getComponentContext()}), mountNode, function () { | ||
console.log('React client-side rendered.'); | ||
}); | ||
/* | ||
* React will "render" the application component at the mountNode and | ||
* compare the results with the existing server-rendered DOM. | ||
* If everything matches (!!), React will mount itself on top and attach | ||
* client-side event handlers. | ||
*/ | ||
React.render( | ||
Component({context: context.getComponentContext()}), | ||
mountNode, | ||
function () { | ||
console.log('React client-side rendered.'); | ||
} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.