R.Flux Class
Item Index
Methods
- _FluxMixinAddListener
- _FluxMixinEventEmitterEmit
- _FluxMixinInject
- _FluxMixinRemoveListener
- _FluxMixinStoreSignalUpdate
- _FluxMixinSubscribe
- _FluxMixinUnsubscribe
- _FluxMixinUpdate
- componentDidMount
- componentWillMount
- createFlux
- destroy
- getDispatcher
- getEventEmitter
- getFluxDispatcher
- getFluxEventEmitter
- getInitialState
- getStore
- prefetchFluxStores
- registerDispatcher
- registerEventEmitter
- registerStore
- serialize
- startInjectingFromStores
- startInjectingFromStores
- unserialize
Methods
_FluxMixinAddListener
-
fn
-
location
Parameters:
-
fn
FonctionThe fn
-
location
StringThe location
_FluxMixinEventEmitterEmit
-
eventEmitterName
-
eventName
-
fn
Parameters:
-
eventEmitterName
StringThe eventEmitterName
-
eventName
StringThe eventName
-
fn
FonctionThe fn
_FluxMixinInject
-
stateKey
-
location
Parameters:
-
stateKey
StringThe stateKey
-
location
StringThe location
_FluxMixinRemoveListener
-
entry
-
uniqueId
Parameters:
-
entry
ObjectThe entry
-
uniqueId
StringThe uniqueId
_FluxMixinStoreSignalUpdate
-
stateKey
-
location
Rerendering a component when data update occurs
Parameters:
-
stateKey
StringThe key to be subscribed
-
location
StringThe url that will be requested
Returns:
_FluxMixinSubscribe
-
stateKey
-
location
Allow a React Component to subscribe at any data in order to fill state
Parameters:
-
stateKey
StringThe key to be subscribed
-
location
StringThe url that will be requested
Returns:
_FluxMixinUnsubscribe
-
entry
-
uniqueId
Parameters:
-
entry
ObjectThe entry
-
uniqueId
StringThe uniqueId
_FluxMixinUpdate
-
props
Manage subscriptions, unsubscriptions and event emitters
Parameters:
-
props
ObjectThe props of component
componentDidMount
()
Call the manager subscriptions when componendDidMount is invoked by React (only client-side)
componentWillMount
()
The componentWillMount of React mechanics
Initialize flux functions for each components when componentWillMount is invoked by React
createFlux
-
specs
Returns a Flux constructor
Parameters:
-
specs
ObjectThe specifications of the flux
destroy
()
Clears the store by calling either this.destroyInServer or this.destroyInClient and recursively applying destroy on each store/event emittre/dispatcher.
Used for pre-rendering magic.
getDispatcher
-
name
Getter for the dispatcher
Parameters:
-
name
StringThe name of the store
Returns:
dispatcher The corresponding dispatcher
getEventEmitter
-
name
Getter for the event emitter
Parameters:
-
name
StringThe name of the store
Returns:
eventEmitter The corresponding event emitter
getFluxDispatcher
-
name
Returns the FluxDispatcher according the provided name
Parameters:
-
name
StringThe name
Returns:
Dispatcher the Dispatcher
getFluxEventEmitter
-
name
Returns the FluxEventEmitter according the provided name
Parameters:
-
name
StringThe name
Returns:
EventEmitter the EventEmitter
getInitialState
()
Object
The getInitialState of React mechanics will be call at:
- React.render()- React.renderToString()
Never return a null object, by default: {}, otherwise return data stocked from the corresponding store
Returns:
object An object like: [stateKey, data]
getStore
-
name
Getter for the store
Parameters:
-
name
StringThe name of the store
Returns:
store The corresponding store
prefetchFluxStores
()
Void
Fetch all components from a root component in order to initialize all data, fill the corresponding stores
Executed server-side
Returns:
registerDispatcher
-
name
-
dispatcher
Register a dispatcher defined in the flux class of App
Parameters:
-
name
StringThe name to register
-
dispatcher
ObjectThe dispatcher to register
registerEventEmitter
-
name
-
eventEmitter
Register an event emitter defined in the flux class of App
Parameters:
-
name
StringThe name to register
-
eventEmitter
ObjectThe event emitter to register
registerStore
-
name
-
store
Register a store defined in the flux class of App
Typically : Memory or Uplink
Parameters:
-
name
StringThe name to register
-
store
ObjectThe store to register
serialize
()
String
Serialize a serialized flux by the server in order to initialize flux into client
Returns:
string The serialized string
startInjectingFromStores
()
Sets the flag telling all the flux-mixed-in components to attempt to inject pre-fetched values from the cache. Used for pre-rendering magic.
startInjectingFromStores
()
Unsets the flag telling all the flux-mixed-in components to attempt to inject pre-fetched values from the cache. Used for pre-rendering magic.
unserialize
-
str
Unserialize a serialized flux by the server in order to initialize flux into client
Parameters:
-
str
StringThe string to unserialize