[TIMOB-1007] Android: Proxy object's methods don't have apply/call methods
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2017-06-12T18:32:42.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | n/a |
Components | Android |
Labels | core |
Reporter | Konstantin |
Assignee | Ingo Muschenetz |
Created | 2011-04-15T02:41:23.000+0000 |
Updated | 2017-06-12T18:32:42.000+0000 |
Description
All object's methods, like ViewProxy methods, DatabaseProxy methods don't have call/apply methods, I mean apply/call methods of JS Function object, it makes impossible to create wrapper around, for example, Titanium.Database.execute method, which accepts variable number of arguments. IMHO it's a very big limitation not described in documentation and creates a lot of troubles to developers.Comments
- Ernesto 2011-04-15
I agree, this is a huge limitation as it isn't noted in the docs and the error thrown is cryptic; custom components are also significantly more difficult to develop, e.g.:
var MyCustomPicker = function(options) { this.picker = Ti.UI.createPicker(options.picker); this.cancelButton = Ti.UI.createButton(options.cancelButton); /* here's the problem, this makes the app to closes with the following message: [DEBUG] Session did end with error (null) */ this.cancelButton.addEventListener( 'click', options.onCancel.apply(this, ['any', 'other', 'possible', 'argument'] ); }; var myPicker = new MyCustomPicker({ onCancel: function() { Ti.API.info(arguments); } });
- Damien Elmes 2011-04-15
A workaround for this was posted in the forums:
if (typeof db.execute.apply !== 'function') { db.execute.apply = Function.prototype.apply; }
- Lee Morris 2017-06-12 Closing ticket due to the time passed and lack of progress since the opening of the ticket. Any problems, please file a new ticket.