What is your opinion about defining arrays or objects as class properties? I always set these in the init() method, because else these arguments are shared across instances. As an example, try this:
This only happens if classes are defined like this:
It does not happen when instances are created like this:
I think this is invalid behavior. I am not sure how often this occurs within the framework, but I avoid these kinds of declaration.
Code:
var a = isc.RestDataSource.create(); // a.operationBindings[0] = {operationType: 'fetch', dataProtocol: 'getParams'} a.operationBindings[0].requestProperties = {}; // a.operationBindings[0] = {operationType: 'fetch', dataProtocol: 'getParams', requestProperties: {}} var b = isc.RestDataSource.create(); // b.operationBindings[0] = {operationType: 'fetch', dataProtocol: 'getParams', requestProperties: {}} (thus, including the requestProperties object)
Code:
isc.defineClass('RestDataSource').addProperties({ operationBindings: [ ... ] });
Code:
isc.RestDataSource.create({ operationBindings: [ ... ] });
Comment