mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 14:18:16 +00:00
[API] Avoid memory leak
https://github.com/nasa/openmct/pull/1212#discussion_r81882955
This commit is contained in:
@ -190,7 +190,9 @@ define([
|
|||||||
* @memberof module:openmct.ObjectAPI#
|
* @memberof module:openmct.ObjectAPI#
|
||||||
*/
|
*/
|
||||||
ObjectAPI.prototype.observe = function (domainObject, path, callback) {
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user