{ "id": "128108", "key": "AC-1067", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2014-03-26T04:26:55.000+0000", "created": "2014-03-25T15:47:24.000+0000", "labels": [], "versions": [], "issuelinks": [ { "id": "36070", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "124873", "key": "TIMOB-16246", "fields": { "summary": "Android: Android handles Ti.App events synchronously but iOS does not", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:37:24.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "When custom event is fired on iOS it is executed with some delay (waits until the executing context has finished).\r\nOn the contrary, when custom event is fired on Android the event handler executes immediately without waiting for the current executing context to finish.\r\n\r\nIssue can be seen with the following sample:\r\n\r\n{code:title=app.js|borderStyle=solid}\r\nvar win = Titanium.UI.createWindow({ \r\n backgroundColor:'red'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n\twidth : 100,\r\n\theight : 100,\r\n\ttitle : \"Click Me\"\r\n});\r\n\r\nbtn.addEventListener(\"click\", function() {\r\n\t\r\n\tfor (var i = 1; i < 6; i++) {\r\n\t\tTi.API.info(i);\r\n\t}\r\n\t\r\n\t// event is only fired here. should not be executed immidiately\r\n\tTi.App.fireEvent(\"myEvent\", {prop1 : \"prop1\"});\r\n\t\r\n\tfor (var i = 6; i < 11; i++) {\r\n\t\tTi.API.info(i);\r\n\t}\r\n});\r\n\r\n\r\nTi.App.addEventListener(\"myEvent\", function(args) {\r\n\tTi.API.info(\"Executing the event handler now...\");\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n\r\n{code}\r\n\r\nwhich produces the following output:\r\n\r\n{code:title=iOS output|borderStyle=solid}\r\n[INFO] : 1\r\n[INFO] : 2\r\n[INFO] : 3\r\n[INFO] : 4\r\n[INFO] : 5\r\n[INFO] : 6\r\n[INFO] : 7\r\n[INFO] : 8\r\n[INFO] : 9\r\n[INFO] : 10\r\n[INFO] : Executing the event handler now...\r\n{code}\r\n\r\n{code:title=Android output|borderStyle=solid}\r\n[INFO] : 1\r\n[INFO] : 2\r\n[INFO] : 3\r\n[INFO] : 4\r\n[INFO] : 5\r\n[INFO] : Executing the event handler now...\r\n[INFO] : 6\r\n[INFO] : 7\r\n[INFO] : 8\r\n[INFO] : 9\r\n[INFO] : 10\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Ti.App.fireEvent behaves differently on iOS and Android", "creator": { "name": "ivo.tasevski", "key": "ivo.tasevski", "displayName": "Ivo", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ivo.tasevski", "key": "ivo.tasevski", "displayName": "Ivo", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "OS X 10.9.2 \r\nTitanium Studio, build: 3.2.1.201402041146\r\nSDK: 3.2.0 GA, 3.2.2 GA", "comment": { "comments": [ { "id": "298612", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks for reporting this issue. It is a duplicate of an existing ticket TIMOB-16246. Please follow along that ticket for further updates.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-03-25T17:44:55.000+0000", "updated": "2014-03-26T04:26:19.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }