fluxible-app
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "fluxible-app", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A pluggable container for isomorphic flux applications", | ||
@@ -31,2 +31,3 @@ "main": "index.js", | ||
"precommit-hook": "1.0.x", | ||
"react": "^0.12.0", | ||
"supertest": "0.10.x" | ||
@@ -33,0 +34,0 @@ }, |
@@ -34,11 +34,9 @@ # fluxible-app | ||
<!-- wait til it's been updated | ||
For a more extensive example of usage both on the server and the client, see [flux-examples](https://github.com/yahoo/flux-examples). | ||
--> | ||
### Dehydration/Rehydration | ||
Fluxible uses reserved methods throughout called `rehydrate` and `dehydrate` which are responsible for taking a snapshot of server-side state so that it can be sent to the browser and rehydrated back to the same state in the browser. This naming scheme also extends to [dispatchr](https://github.com/yahoo/dispatchr) which takes care of dehydrating/rehydrating the store instances. | ||
fluxible-app uses reserved methods throughout called `rehydrate` and `dehydrate` which are responsible for taking a snapshot of server-side state so that it can be sent to the browser and rehydrated back to the same state in the browser. This naming scheme also extends to [dispatchr](https://github.com/yahoo/dispatchr) which takes care of dehydrating/rehydrating the store instances. | ||
There are two kinds of state within FluxibleApp: | ||
There are two kinds of state within fluxible-app: | ||
@@ -52,3 +50,3 @@ * **Application State**: Settings and data that are registered on server start | ||
Within a context, Fluxible creates interfaces providing access to only certain parts of the system. These are broken down as such: | ||
Within a context, fluxible-app creates interfaces providing access to only certain parts of the system. These are broken down as such: | ||
@@ -87,3 +85,3 @@ * **Action Context**: interface accessible by action creator methods. Passed as first parameter to all action creators. | ||
// to send data down to the client | ||
rehydrate: function () { | ||
dehydrate: function () { | ||
return { | ||
@@ -94,3 +92,3 @@ foo: foo | ||
// Called on client to rehydrate the context plugin settings | ||
dehydrate: function (state) { | ||
rehydrate: function (state) { | ||
foo = state.foo; | ||
@@ -101,3 +99,3 @@ } | ||
// Allows dehydration of application plugin settings | ||
dehydrate: function () { return {}; } | ||
dehydrate: function () { return {}; }, | ||
// Allows rehydration of application plugin settings | ||
@@ -115,5 +113,9 @@ rehydrate: function (state) {} | ||
Example plugins: | ||
* [fluxible-plugin-fetchr](https://github.com/yahoo/fluxible-plugin-fetchr) - Polymorphic RESTful services | ||
* [fluxible-plugin-routr](https://github.com/yahoo/fluxible-plugin-routr) - Routing behavior | ||
## Store Mixin | ||
FluxibleApp also provides a React component mixin that can be used to statically list store dependencies and listen to them automatically in componentDidMount. This is done by adding a static property `storeListeners` in your component. | ||
fluxible-app also provides a React component mixin that can be used to statically list store dependencies and listen to them automatically in componentDidMount. This is done by adding a static property `storeListeners` in your component. | ||
@@ -145,3 +147,3 @@ You can do this with an array, which will default all store listeners to call the `onChange` method: | ||
storeListeners: { | ||
onMockStoreChange: MockStore | ||
onMockStoreChange: [MockStore] | ||
} | ||
@@ -157,2 +159,6 @@ }, | ||
## Helper Utilities | ||
fluxible-app also exports [dispatcher's store utilities](https://github.com/yahoo/dispatchr#helper-utilities) so that you do not need to have an additional dependency on dispatchr. They are available by using `require('fluxible-app/utils/BaseStore')` and `require('fluxible-app/utils/createStore')`. | ||
## API | ||
@@ -159,0 +165,0 @@ |
@@ -7,4 +7,3 @@ /** | ||
var MockFetcher = require('./MockFetcher'), | ||
dispatchr = require('dispatchr'); | ||
var dispatchr = require('dispatchr'); | ||
@@ -19,3 +18,2 @@ module.exports = function createMockActionContext() { | ||
this.dispatchCalls = []; | ||
this.fetcher = new MockFetcher(); | ||
} | ||
@@ -22,0 +20,0 @@ |
Sorry, the diff of this file is not supported yet
262
79062
15
605