Interface: BaseController\<ModuleDefinition>
Defined in: types/BaseController.ts:10
Controllers are the public interface for interacting with providence modules in your store of choice. There will only ever be one controller per registered module, thanks to the registry. The controller should not hold information that can't be reconstructed upon hot reload. It should merely be an interface for manipulating the registered module.
Extended by
Type Parameters
ModuleDefinition
ModuleDefinition extends AnyModule
Properties
attr
attr: \<
Key>(attrName) =>ModuleDefinition["state"][Key]
Defined in: types/BaseController.ts:40
Retrieves a particular attribute from the state for this module.
Type Parameters
Key
Key extends string
Parameters
attrName
Key
Returns
ModuleDefinition["state"][Key]
commit
commit: \<
OutsideModuleDefinition,Key>(funcName, ...payload) =>void
Defined in: types/BaseController.ts:44
Commits a mutation for this module.
Type Parameters
OutsideModuleDefinition
OutsideModuleDefinition extends BaseModule\<any, any, any> = ModuleDefinition
Key
Key extends string = string & keyof OutsideModuleDefinition["mutations"]
Parameters
funcName
Key | `${string}/${Key}`
payload
...ParametersExceptFirst\<OutsideModuleDefinition["mutations"][Key]>
Returns
void
dispatch
dispatch: (\<
Key>(funcName, ...payload) =>ReturnType\<ModuleDefinition["tasks"][Key]>) | (\<Key>(funcName, ...payload) =>ReturnType\<ModuleDefinition["tasks"][Key]>)
Defined in: types/BaseController.ts:48
Dispatches a task for this module.
managedNames
managedNames:
string[]
Defined in: types/BaseController.ts:36
Returns the names of all modules this module manages. For singles, that will only be the current module name. For lists, it will be the current module name and all the names of the singles it manages.
name
name:
string
Defined in: types/BaseController.ts:21
The name of the dynamically created module. This is a dot separated name. You can construct an escaped, valid name with use of the flattenNamespace function.
namespace
namespace:
string[]
Defined in: types/BaseController.ts:31
Useful for when needing to walk through modules for an operation, namespace returns an array of strings representing this module's location in the hierarchy.
preDestroy
preDestroy: () =>
void
Defined in: types/BaseController.ts:53
A function which is run after the controller is no longer needed (because all listeners have disconnected), before it is removed from the store.
Returns
void
rawState
rawState:
ModuleDefinition["state"]
Defined in: types/BaseController.ts:26
The raw state of the dynamically created module. This should be a copy so mutating the output doesn't affect the state.