From: 扩散性百万甜面包 Date: Sun, 6 Oct 2019 15:27:09 +0000 (+0800) Subject: refactor: rename param on function watch (#134) X-Git-Tag: v3.0.0-alpha.0~581 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d2d32d381047ff8b4d351ee49f46a52d67c517df;p=thirdparty%2Fvuejs%2Fcore.git refactor: rename param on function watch (#134) --- diff --git a/packages/runtime-core/src/apiWatch.ts b/packages/runtime-core/src/apiWatch.ts index 139767c656..b7139d62ea 100644 --- a/packages/runtime-core/src/apiWatch.ts +++ b/packages/runtime-core/src/apiWatch.ts @@ -70,18 +70,18 @@ export function watch( | WatcherSource | WatcherSource[] | SimpleEffect, - effectOrOptions?: + cbOrOptions?: | ((value: any, oldValue: any, onCleanup: CleanupRegistrator) => any) | WatchOptions, options?: WatchOptions ): StopHandle { - if (isFunction(effectOrOptions)) { + if (isFunction(cbOrOptions)) { // effect callback as 2nd argument - this is a source watcher - return doWatch(effectOrSource, effectOrOptions, options) + return doWatch(effectOrSource, cbOrOptions, options) } else { // 2nd argument is either missing or an options object // - this is a simple effect watcher - return doWatch(effectOrSource, null, effectOrOptions) + return doWatch(effectOrSource, null, cbOrOptions) } }