{ "id": "61614", "key": "TIMOB-982", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11224", "name": "Release 1.4.0", "archived": true, "released": true, "releaseDate": "2010-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:54:52.000+0000", "created": "2011-04-15T02:40:42.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:54:52.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

code:

\n

// this sets the background color of the master UIView (when\nthere are no windows/tab groups on it)\nTitanium.UI.setBackgroundColor('#000');

\n

// create tab group var tabGroup =\nTitanium.UI.createTabGroup();

\n

Titanium.App.addEventListener('close',function(e)
\n{

\n
\nalert(\"The application is being shutdown\");\n
\n

});

\n

// // create base UI tab and root window // var win1 =\nTitanium.UI.createWindow({

\n
\ntitle:'Tab 1',\nbackgroundColor:'#fff',\nbarColor:'#005298'\n
\n

});

\n

var tab1 = Titanium.UI.createTab({

\n
\nicon:'KS_nav_views.png',\ntitle:'Tab 1',\nwindow:win1\n
\n

});

\n

var navbar = Titanium.UI.createTabbedBar({

\n
\nlabels:[\"A\", \"B\"],\nstyle:Titanium.UI.iPhone.SystemButtonStyle.BAR,\nbackgroundColor:\"#005298\"\n
\n

});

\n

win1.setTitleControl(navbar);

\n

var scrollView = Titanium.UI.createScrollView({

\n
\ncontentHeight: 'auto',\ncontentWidth:'auto',\ntop:0,\nshowVerticalScrollIndicator:true,\nshowHorizontalScrollIndicator:true\n
\n

});

\n

var view = Titanium.UI.createView({

\n
\nwidth:300,\nheight:100,\ntop:20,\nborderRadius:5,\nbackgroundGradient:{\n    type:'linear',\n    colors:[{color:'#005298',position:0.0},\n                    {color:'#001d36',position:1.0}]\n\n}\n
\n

});

\n

scrollView.add(view);
\nwin1.add(scrollView);

\n

// // add tabs // tabGroup.addTab(tab1);

\n

// open tab group tabGroup.open();

{html}", "attachment": [], "flagged": false, "summary": "Ti.App.addEventListener('close') not working", "creator": { "name": "nwright", "key": "nwright", "displayName": "Nolan Wright", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "nwright", "key": "nwright", "displayName": "Nolan Wright", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "124504", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This is a little misleading: The callback happens, but only\nafter the program has suspended, which means that nothing is going\nto get logged. Seems like this will mostly end up being a\ndocumentation issue, provided that I can confirm that the stuff in\nthe callback is actually happening (probably via a contacts or iPod\ntest app).

\n

Once this is taken care of there will need to be some additional\ninfrastructure for 4.0's pause/resume.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:43.000+0000", "updated": "2011-04-15T02:40:43.000+0000" }, { "id": "124505", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Okay, much worse than I thought. There's a race between Titanium\nand the OS to see when resources get freed up: The system wants to\nrelease them immediately, and Titanium wants to try and finish\neverything up. 4.0 allows for the application to demand additional\ntime to finish tasks in the background, but allowing compilation\nfor 3.1.x (and iPad) means that app event support wouldn't work on\nthese systems.

\n

Investigating further.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:43.000+0000", "updated": "2011-04-15T02:40:43.000+0000" }, { "id": "124506", "author": { "name": "dasher", "key": "dasher", "displayName": "Dasher", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Just so it doesn't slip through the cracks - this is also an\nissue on Android :)

{html}", "updateAuthor": { "name": "dasher", "key": "dasher", "displayName": "Dasher", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:43.000+0000", "updated": "2011-04-15T02:40:43.000+0000" }, { "id": "124507", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tag team coding. Swapping with Steve.

{html}", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:43.000+0000", "updated": "2011-04-15T02:40:43.000+0000" }, { "id": "124508", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [f6e6787856b1faf7e7b71cd577b775544b25d0ee])\nWhen closing, the app now sends the close event before the rest of\nthe shutdown, and waits for the function to be processed before\nexiting. Note that it does mean if the javascript takes too long,\nthe app will be force quit like the iPhone OS would any other app.\nCloses #982 \nhttp://github.com/appcelerator/titanium_mobile/commit/f6e6787856b1f...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:43.000+0000", "updated": "2011-04-15T02:40:43.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }