Index: src/object-observe.js |
diff --git a/src/object-observe.js b/src/object-observe.js |
index ea5de1f6e5b2b5e538a95890e392cbcbd10ac2a7..c9ae652a53e1d273871bbdb510ce5d31bd89fa3d 100644 |
--- a/src/object-observe.js |
+++ b/src/object-observe.js |
@@ -88,10 +88,10 @@ function ObjectObserve(object, callback) { |
} |
var changeObservers = objectInfo.changeObservers; |
- if (changeObservers.indexOf(callback) >= 0) |
- return; |
+ if (changeObservers.indexOf(callback) < 0) |
+ changeObservers.push(callback); |
- changeObservers.push(callback); |
+ return object; |
} |
function ObjectUnobserve(object, callback) { |
@@ -102,14 +102,14 @@ function ObjectUnobserve(object, callback) { |
var objectInfo = objectInfoMap.get(object); |
if (IS_UNDEFINED(objectInfo)) |
- return; |
+ return object; |
var changeObservers = objectInfo.changeObservers; |
var index = changeObservers.indexOf(callback); |
- if (index < 0) |
- return; |
+ if (index >= 0) |
+ changeObservers.splice(index, 1); |
- changeObservers.splice(index, 1); |
+ return object; |
} |
function EnqueueChangeRecord(changeRecord, observers) { |