@@ -17,9 +17,9 @@ const scope = effectScope()
1717scope .run (() => {
1818 const doubled = computed (() => counter .value * 2 )
1919
20- watch (doubled , () => console .log (double .value ))
20+ watch (doubled , () => console .log (doubled .value ))
2121
22- watchEffect (() => console .log (' Count: ' , double .value ))
22+ watchEffect (() => console .log (' Count: ' , doubled .value ))
2323})
2424
2525// to dispose all effects in the scope
@@ -47,7 +47,7 @@ const stopWatch1 = watchEffect(() => {
4747disposables .push (stopWatch1 )
4848
4949const stopWatch2 = watch (doubled , () => {
50- console .log (double .value )
50+ console .log (doubled .value )
5151})
5252
5353disposables .push (stopWatch2 )
@@ -96,9 +96,9 @@ A scope can run a function and will capture all effects created during the funct
9696scope .run (() => {
9797 const doubled = computed (() => counter .value * 2 )
9898
99- watch (doubled , () => console .log (double .value ))
99+ watch (doubled , () => console .log (doubled .value ))
100100
101- watchEffect (() => console .log (' Count: ' , double .value ))
101+ watchEffect (() => console .log (' Count: ' , doubled .value ))
102102})
103103
104104// the same scope can run multiple times
@@ -133,10 +133,10 @@ scope.run(() => {
133133
134134 // not need to get the stop handler, it will be collected by the outer scope
135135 effectScope ().run (() => {
136- watch (doubled , () => console .log (double .value ))
136+ watch (doubled , () => console .log (doubled .value ))
137137 })
138138
139- watchEffect (() => console .log (' Count: ' , double .value ))
139+ watchEffect (() => console .log (' Count: ' , doubled .value ))
140140})
141141
142142// dispose all effects, including those in the nested scopes
@@ -150,7 +150,7 @@ scope.stop()
150150This also makes usages like [ "lazy initialization"] ( https://github.com/vuejs/vue-next/issues/1532 ) possible.
151151
152152``` ts
153- let childScope
153+ let nestedScope
154154
155155const parentScope = effectScope ()
156156
@@ -159,15 +159,15 @@ parentScope.run(() => {
159159
160160 // with the detected flag,
161161 // the scope will not be collected and disposed by the outer scope
162- childScope = effectScope (true /* detached */ )
163- childScope .run (() => {
164- watch (doubled , () => console .log (double .value ))
162+ nestedScope = effectScope (true /* detached */ )
163+ nestedScope .run (() => {
164+ watch (doubled , () => console .log (doubled .value ))
165165 })
166166
167- watchEffect (() => console .log (' Count: ' , double .value ))
167+ watchEffect (() => console .log (' Count: ' , doubled .value ))
168168})
169169
170- // disposes all effects, but not `childScope `
170+ // disposes all effects, but not `nestedScope `
171171parentScope .stop ()
172172
173173// stop the nested scope only when appropriate
0 commit comments