@redux-tools/namespaces v0.9.1
@redux-tools/namespaces
This package provides the main logic for associating Redux actions with a namespace.
API Reference
isActionFromNamespace
Function which checks if a Redux action is from a certain namespace. Returns false
when both namespaces are defined and not equal, otherwise returns true
.
There are essentially two edge cases:
- If the action has no namespace, it is a global action and therefore affects all namespaces.
- If the tested namespace is undefined, it is a global namespace and is therefore affected by all actions.
- This allows easier usage of other packages (notably using
namespacedConnect
for dispatching actions affecting global reducers and epics, instead of having to useconnect
separately). Note that this behavior may be changed in the future versions.
- This allows easier usage of other packages (notably using
Arguments
action
(Action): The Redux action to check. Should have ameta.namespace
property.namespace
(string): The namespace to check against.
Returns
(boolean): Whether the Redux action is from the specified namespace.
getNamespaceByAction
- Returns the namespace of an action.
Arguments
action
(Action): The Redux action to get the namespace of. Should have ameta.namespace
property.
Returns
(any): The value of the meta.namespace
property.
attachNamespace
Associates an action with a namespace, overwriting any previous namespace.
Arguments
namespace
(string): The namespace to attach.action
(Action): Action to attach the namespace to.
Returns
(Action): A new Redux action with a meta.namespace
property.
defaultNamespace
Associates an action with a namespace unless it is already associated with some namespace.
Arguments
namespace
(string): The namespace to default to.action
(Action): Action to default the namespace of.
Returns
(Action): A new Redux action with a meta.namespace
property.
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago