googlearchive / observe-js

A library for observing Arrays, Objects and PathValues
1.35k stars 116 forks source link

Can't reopen a closed observer #91

Closed bensleveritt closed 9 years ago

bensleveritt commented 9 years ago

I'm not sure if this is intended, but trying to reopen a closed observer throws the error Observer has already been opened.

Is it best just to remove the observer completely and reinitialise?

jmesserly commented 9 years ago

Is it best just to remove the observer completely and reinitialise?

exactly right, it's not intended to re-open a closed observer. think of "close" like a "dispose" ... it's called when the observer is no longer need. (As an optimization, the system will try to reuse observer instances, which is probably why you got that error message. Look for observedObjectCache in the code.)

bensleveritt commented 9 years ago

Thanks for the clarification!