]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: add description to the action helper
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 7 Mar 2025 14:08:19 +0000 (15:08 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 7 Mar 2025 14:08:25 +0000 (15:08 +0100)
packages/pinia/src/store.ts

index a7be113ce3335972b7e77085e6ba17ec906e84c7..bed44b203841564e87633e681fd2426e58bcb187 100644 (file)
@@ -780,7 +780,15 @@ export type StoreState<SS> =
     : _ExtractStateFromSetupStore<SS>
 
 export interface SetupStoreHelpers {
-  action: <Fn extends _Method>(fn: Fn) => Fn
+  /**
+   * Helper that wraps function so it can be tracked with $onAction when the
+   * action is called **within the store**. This helper is rarely needed in
+   * applications. It's intended for advanced use cases like Pinia Colada.
+   *
+   * @param fn - action to wrap
+   * @param name - name of the action. Will be picked up by the store at creation
+   */
+  action: <Fn extends _Method>(fn: Fn, name?: string) => Fn
 }
 
 /**