[TIMOB-3216] Android: Expose Properties Dictionary
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Trivial |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T02:01:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint-2011-09 |
Components | Android |
Labels | android, feature, release-1.7.0, reported-1.6.0, rplist |
Reporter | Dawson Toth |
Assignee | Don Thorp |
Created | 2011-04-15T03:39:41.000+0000 |
Updated | 2011-04-17T02:01:12.000+0000 |
Description
Problem
Object.keys and for X in Y should work for proxy objects. Right now you can't do for (var n in Ti.UI.createWindow({ left: 0, right: 0 }) {}, for example.
Example App
var win = Ti.UI.createWindow({ backgroundColor: '#fff', title: 'Test' });
win.color = '#444';
var label = Ti.UI.createLabel({ left: 20, right: 20 });
win.add(label);
win.open();
label.text = '';
for (var n in win) {
label.text += n + ': ' + win[n] + ',\n';
}
if (label.text.length == 0) {
label.text = 'FAIL: We were not able to iterate over the properties of the proxy object using for-in!';
}
The label.text will contain a line for each property.
Tested On
Titanium SDK version: 1.7.0 (02/18/11 18:13 316c2c7)
BROKEN in iPhone Simulator 4.2
BROKEN on Android EPIC 4g Device 2.1
Associated Helpdesk Ticket
http://developer.appcelerator.com/helpdesk/view/75581">http://developer.appcelerator.com/helpdesk/view/75581
(from [5d8c78a437289743b62125b34634862775fcff05]) initial support of for (x in proxy) and Object.keys(proxy).forEach in Android [#3216 state:fixed-in-qa milestone:Sprint-2011-09]
https://github.com/appcelerator/titanium_mobile/commit/5d8c78a437289743b62125b34634862775fcff05"> https://github.com/appcelerator/titanium_mobile/commit/5d8c78a43728...
Updated to test both Object.keys and Object.getOwnPropertyNames:
Tested with Titanium SDK version: 1.7.0 (03/03/11 11:06 87a2113) on
Emulator 2.1
Galaxy Tab 2.2
Still broken on iPhone 4 OS 4.2.1 and Emulator
Created #3299 to track the iOS side of this problem. Marking this one as resolved per Natalie's comment. Adding the release 1.7.0 tag back it got removed.