Methods
addActions(actionProvider)
This function takes an object of actions and to add them to the global store making them available from anywhere. Example:
import { flue } from 'flue-vue'
const actions = {
test() {
flue.dispatch(new Action("TEST_ACTION"))
}
}
flue.addActions(actions)
flue.actions.test()
- Source:
Parameters:
Name | Type | Description |
---|---|---|
actionProvider |
function
|
addActionsFromStore(store)
Copy all the store's action, if any. This is done automatically when a new store is added using flye.addStore(Store)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
store |
Store
|
addProvider(provider)
It may be convinient to add some external package directly into flue in order to make it available from all the stores and components. Example:
import axios from 'axios'
flue.addProvider({ key: 'client', source: axios })
flue.providers.client.get(...)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
provider |
Object
|
A provider. |
addReducer(reducer)
Add a raw reducer function, a unnamed store will be created and its reduce function overrided Example:
var reducer = (action) => { console.log(action.type) } flue.addReducer(reducer)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
reducer |
function
|
addStore(store)
This function add Store to the global flue instance, under the hood it override the state pointer of each store with the global one
- Source:
Parameters:
Name | Type | Description |
---|---|---|
store |
Store
|
A Store instance |
addStores(arrayOfStores)
Add multiple stores at the same tme
- Source:
Parameters:
Name | Type | Description |
---|---|---|
arrayOfStores |
Array.<Store>
|
applyGlobalMiddleware(middlewares)
This function applies the given middlewares to each store. Redux middlewares can be used
- Source:
Parameters:
Name | Type | Description |
---|---|---|
middlewares |
Array
|
applyMiddlewareToStore(stores, middlewares)
This function applies the given middlewares to a single store Redux middlewares can be used
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stores |
Store
|
A Store instance |
middlewares |
Array
|
applyMiddlewareToStores(stores, middlewares)
This function applies the given middlewares to multiple stores Redux middlewares can be used
- Source:
Parameters:
Name | Type | Description |
---|---|---|
stores |
Array
|
An Array of Stores |
middlewares |
Array
|