Forráskód Böngészése

chore: document parameters of onWatcherCleanup (#11768)

Cédric Exbrayat 1 éve
szülő
commit
d427bcd71c
2 módosított fájl, 5 hozzáadás és 1 törlés
  1. 1 1
      packages/reactivity/src/effect.ts
  2. 4 0
      packages/reactivity/src/watch.ts

+ 1 - 1
packages/reactivity/src/effect.ts

@@ -507,7 +507,7 @@ export function resetTracking(): void {
  * The cleanup function is called right before the next effect run, or when the
  * effect is stopped.
  *
- * Throws a warning iff there is no currenct active effect. The warning can be
+ * Throws a warning if there is no current active effect. The warning can be
  * suppressed by passing `true` to the second argument.
  *
  * @param fn - the cleanup function to be registered

+ 4 - 0
packages/reactivity/src/watch.ts

@@ -95,6 +95,10 @@ export function getCurrentWatcher(): ReactiveEffect<any> | undefined {
  * associated effect re-runs.
  *
  * @param cleanupFn - The callback function to attach to the effect's cleanup.
+ * @param failSilently - if `true`, will not throw warning when called without
+ * an active effect.
+ * @param owner - The effect that this cleanup function should be attached to.
+ * By default, the current active effect.
  */
 export function onWatcherCleanup(
   cleanupFn: () => void,