[API] Avoid memory leak

https://github.com/nasa/openmct/pull/1212#discussion_r81882955
This commit is contained in:
Victor Woeltjen 2016-10-06 17:46:26 -07:00
parent b0e842863d
commit 772d24b173

View File

@ -190,7 +190,9 @@ define([
* @memberof module:openmct.ObjectAPI#
*/
ObjectAPI.prototype.observe = function (domainObject, path, callback) {
return new MutableObject(domainObject).on(path, callback);
var mutableObject = new MutableObject(domainObject);
mutableObject.on(path, callback);
return mutableObject.stopListening.bind(mutableObject);
};
/**