-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add getter function for Properties #1570
Add getter function for Properties #1570
Conversation
Hi @michalvankodev,
If these aren't sufficient for what you need could you please provide some more context so we can better understand your actual needs? Or, perhaps you can link the commit where you fix the memory leak you're seeing? |
Hi @dchambers I am not fixing a memory leak. I'm avoiding creating one with usage of |
Hi @michalvankodev, any chance you could point me to the code snippet in question so I can take a look for myself? |
Sorry for the delay @michalvankodev, I've only just now had a chance to look at this. AFAICT, this is the relevant bit of code: XXXPM.prototype._setUpNodeListeners = function() {
var nodes = this.rows.getPresentationNodesArray();
this._propertyHelper.removeAllListeners();
nodes.forEach(function(node) {
var properties = node.properties().getProperties();
properties.forEach(function(prop) {
this._propertyHelper.addChangeListener(prop, this, '_onNodesChanged', false);
}, this);
}, this);
}; Excuse my ignorance, but what is |
@michalvankodev, could you please change your method to this: Properties.prototype.getProperties = function() {
return this.m_pProperties.slice(0);
}; so that the original can't be mutated. |
Thanks @michalvankodev 👍 |
I'd like to attach listeners to the properties of
Properties
viaPropertyHelper
to avoid memory leaks.PropertyHelper accepts only
Property
objects as arguments.