You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you wrap an object method which is inherited from the object's prototype, and then .unwrap(), it doesn't remove the object's own method. So the object is left in a different state from how it began.
c.myMethod has been restored to its original value, but it's now present on the object, rather than inherited from the prototype.
Now, if you make a change to the prototype, it's not reflected in the behavior of the object method.
C.prototype.myMethod=function(){return'B';};console.log(c.myMethod());// still outputs 'A'
The docs for .unwrap() say it is "for restoring the function back the way it was before you started". This is a bit ambiguous, but if you read this as "restoring everything back the way it was" then the current behavior is incorrect.
Perhaps this is a rather small point, but it bit me on something, so I thought I'd raise it.
The text was updated successfully, but these errors were encountered:
If you wrap an object method which is inherited from the object's prototype, and then
.unwrap()
, it doesn't remove the object's own method. So the object is left in a different state from how it began.c.myMethod
has been restored to its original value, but it's now present on the object, rather than inherited from the prototype.Now, if you make a change to the prototype, it's not reflected in the behavior of the object method.
The docs for
.unwrap()
say it is "for restoring the function back the way it was before you started". This is a bit ambiguous, but if you read this as "restoring everything back the way it was" then the current behavior is incorrect.Perhaps this is a rather small point, but it bit me on something, so I thought I'd raise it.
The text was updated successfully, but these errors were encountered: