{ "id": "176035", "key": "TIMOB-28340", "fields": { "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "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": "21050", "name": "Release 10.0.0", "archived": false, "released": true, "releaseDate": "2021-05-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2021-02-08T18:59:19.000+0000", "created": "2021-02-08T18:58:38.000+0000", "epic": { "id": 172628, "key": "TIMOB-26570", "name": "Node Compatibility", "summary": "Node compatibility and developer experience", "color": { "key": "color_3" }, "done": false }, "priority": { "name": "High", "id": "2" }, "labels": [ "engSchedule" ], "versions": [], "issuelinks": [ { "id": "59171", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "outwardIssue": { "id": "174615", "key": "TIMOB-27710", "fields": { "summary": "TiAPI: Support optional callback functions for async methods that typically fire events", "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": "High", "id": "2" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } }, { "id": "59175", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "174726", "key": "TIMOB-27763", "fields": { "summary": "iOS: “don’t allow” in push notification dialog triggering success callback", "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" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "59174", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "170383", "key": "TIMOB-25536", "fields": { "summary": "TiAPI: Deprecate Ti global namespace, move to require/import based API's", "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": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } }, { "id": "59173", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "166898", "key": "TIMOB-24549", "fields": { "summary": "TiAPI: Add support for Promises", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "6", "description": "gh.issue.epic.desc", "name": "Epic", "subtask": false } } } }, { "id": "59172", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "174617", "key": "TIMOB-27711", "fields": { "summary": "TiAPI: Add state querying methods to UI components", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2021-04-13T12:28:08.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": "10224", "name": "TiAPI", "description": "This component is used for cross-platform API work. Specifications are most likely to use this component." } ], "description": "We have a number of basic operations that rely on event listener based usage to handle notifying when the operation is \"complete\". While this works, it can lead to a lot of boilerplate code for hanging simple one-time callback logic when the operation is complete.\r\n\r\ni.e. We often have a single listener on Ti.UI.Window#close() where we want to clean up after the windows is closed. Compare:\r\n{code:javascript}\r\nwin.addEventListener('close', function listener (e) {\r\n win.removeEventListener('close', listener); // clean up this callback listener\r\n // do whatever other cleanup we want\r\n});\r\nwin.close();\r\n\r\n// versus\r\n\r\nwindow.close(e => {\r\n // do whatever other cleanup we want\r\n});\r\n{code}\r\n\r\nIt would be good to review our APIs and the events we fire and see if they are explicitly tied to methods called by the developer - and if so, provide optional callback functions as the final arguments so that developers could use a more Node.JS style usage and streamline cases where you only expect a single listener/callback (though for backwards compatibility and for supporting multiple listeners we shoulder retain the event firing as well).\r\n\r\nNote that this would also position us well to add \"shims\" to convert these methods calls into Promise-based APIs at the JS level.\r\n{code:javascript}\r\nwin.close().then(e => {\r\n // do whatever other cleanup we want\r\n});\r\n// or...\r\nconst closeEvent = await win.close();\r\n// do whatever other cleanup we want\r\n{code}", "attachment": [], "flagged": false, "summary": "TiAPI: Return Promise for Ti.UI.Window open() and close()", "creator": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "environment": null, "closedSprints": [ { "id": 1217, "state": "closed", "name": "2021 Sprint 4", "startDate": "2021-02-16T00:52:00.000Z", "endDate": "2021-02-27T00:52:00.000Z", "completeDate": "2021-02-28T18:56:28.465Z", "originBoardId": 114 }, { "id": 1219, "state": "closed", "name": "2021 Sprint 5", "startDate": "2021-03-01T19:02:00.000Z", "endDate": "2021-03-12T19:02:00.000Z", "completeDate": "2021-03-15T03:30:49.472Z", "originBoardId": 114 }, { "id": 1220, "state": "closed", "name": "2021 Sprint 6", "startDate": "2021-03-15T03:31:12.088Z", "endDate": "2021-03-27T03:31:00.000Z", "completeDate": "2021-03-26T19:18:15.760Z", "originBoardId": 114 }, { "id": 1221, "state": "closed", "name": "2021 Sprint 7", "startDate": "2021-03-29T19:18:00.000Z", "endDate": "2021-04-09T19:18:00.000Z", "completeDate": "2021-04-12T21:26:15.427Z", "originBoardId": 114 }, { "id": 1222, "state": "closed", "name": "2021 Sprint 8", "startDate": "2021-04-12T21:26:41.532Z", "endDate": "2021-04-23T21:26:00.000Z", "completeDate": "2021-04-28T15:13:56.824Z", "originBoardId": 114 }, { "id": 1216, "state": "closed", "name": "2021 Sprint 3", "startDate": "2021-02-01T17:42:00.000Z", "endDate": "2021-02-12T17:42:00.000Z", "completeDate": "2021-02-12T22:01:52.235Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "458186", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "https://github.com/appcelerator/titanium_mobile/pull/12407", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2021-02-08T18:59:19.000+0000", "updated": "2021-02-08T18:59:19.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }