API Documentation / pinia / _StoreOnActionListenerContext
Interface: _StoreOnActionListenerContext<Store, ActionName, A>
pinia._StoreOnActionListenerContext
Actual type for StoreOnActionListenerContext. Exists for refactoring purposes. For internal use only. For internal use only
Type parameters
Name | Type |
---|---|
Store | Store |
ActionName | extends string |
A | A |
Properties
args
• args: A
extends Record
<ActionName
, _Method
> ? Parameters
<A
[ActionName
]> : unknown
[]
Parameters passed to the action
Defined in
packages/pinia/src/types.ts:195
name
• name: ActionName
Name of the action
Defined in
packages/pinia/src/types.ts:185
store
• store: Store
Store that is invoking the action
Defined in
packages/pinia/src/types.ts:190
Methods
after
▸ after(callback
): void
Sets up a hook once the action is finished. It receives the return value of the action, if it's a Promise, it will be unwrapped.
Parameters
Name | Type |
---|---|
callback | A extends Record <ActionName , _Method > ? (resolvedReturn : _Awaited <ReturnType <A [ActionName ]>>) => void : () => void |
Returns
void
Defined in
packages/pinia/src/types.ts:203
onError
▸ onError(callback
): void
Sets up a hook if the action fails. Return false
to catch the error and stop it fro propagating.
Parameters
Name | Type |
---|---|
callback | (error : unknown ) => void |
Returns
void
Defined in
packages/pinia/src/types.ts:213