UNPKG

@zedux/core

Version:

A high-level, declarative, composable form of Redux

32 lines (31 loc) 1.48 kB
import { Store } from '../api/createStore'; import { HierarchyDescriptor, Reducer } from '../types'; import { HierarchyNode, RegisterSubStore } from '../utils/types'; /** * Determines the HierarchyNodeType of the given hierarchy descriptor. * * Throws a TypeError if the descriptor is invalid. */ export declare const getHierarchyType: (descriptor: HierarchyDescriptor) => 1 | 2 | 3 | 4; /** * Turns a normal, user-supplied hierarchy descriptor into a Hierarchy for easy * reducer hierarchy creating, diffing, merging, and destroying. * * Also figures out the reducer for non-branch nodes. */ export declare const hierarchyDescriptorToHierarchy: (hierarchy: HierarchyDescriptor, registerSubStore: RegisterSubStore, currentPath?: string[]) => HierarchyNode; /** * Creates a reducer that wraps the entry points of the given store. * * This reducer will propagate actions down the child store's reducers. * * Wraps all actions in the special `inherit` meta node to inform the child * store's effects subscribers that this action was received from its parent * store. * * Since the parent store also registers an effects subscriber on this child * store, it will know not to propagate the inherited action from the child * store. UPDATE: Actually, it doesn't even need to check - the parent store * knows that it _isDispatching and can ignore child store actions while it is. */ export declare const wrapStoreInReducer: <State>(store: Store<State>) => Reducer<any>;