8000 emit only once in object.$add · openwings/vue@bab4829 · GitHub
[go: up one dir, main page]

Skip 8000 to content

Commit bab4829

Browse files
committed
emit only once in object.$add
1 parent c941fd6 commit bab4829

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/observer.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,7 @@ var ObjProxy = Object.create(Object.prototype)
134134
def(ObjProxy, '$add', function (key, val) {
135135
if (hasOwn.call(this, key)) return
136136
this[key] = val
137-
convertKey(this, key)
138-
// emit a propagating set event
139-
this.__emitter__.emit('set', key, val, true)
137+
convertKey(this, key, true)
140138
}, !hasProto)
141139

142140
def(ObjProxy, '$delete', function (key) {
@@ -235,7 +233,7 @@ function watchArray (arr) {
235233
* so it emits get/set events.
236234
* Then watch the value itself.
237235
*/
238-
function convertKey (obj, key) {
236+
function convertKey (obj, key, propagate) {
239237
var keyPrefix = key.charAt(0)
240238
if (keyPrefix === '$' || keyPrefix === '_') {
241239
return
@@ -246,7 +244,7 @@ function convertKey (obj, key) {
246< 629B /td>244
var emitter = obj.__emitter__,
247245
values = emitter.values
248246

249-
init(obj[key])
247+
init(obj[key], propagate)
250248

251249
oDef(obj, key, {
252250
enumerable: true,

0 commit comments

Comments
 (0)
0