Tide Fire Namespace middleware
What?
Middleware for tide-fire that allows for namespaced action handlers.
Why?
For some applications it's natural to separate different parts of the app into namespaces. Since tide-fire is built specifically for large apps, it makes sense to also support namespaces.
How?
Install by adding tide-fire-namespace-middleware to your middleware array when you init fide-fire.
/*Assume the following state shape:const state = {bar: {beer: 'Singha',},weather: 'Rainy',}*/
If you want to set a namespace for a set of action handlers, define a __namespace
prop on that part of the actionHandlers object.
const actionHandlers =bar:__namespace: 'bar'
In the example above, set(['beer', data])
will set data on the path ['bar', 'beer']
. Similarly, get(['beer'])
would get from ['bar', 'beer']
.
Action handlers also have access to getGlobal
and setGlobal
functions.
const actionHandlers =bar:__namespace: 'bar'
Reporting issues
Issues should be filed here on github.