{ "id": "170383", "key": "TIMOB-25536", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": [], "resolution": null, "resolutiondate": null, "created": "2017-11-19T23:39:54.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": [ "roadmap2019" ], "versions": [], "issuelinks": [ { "id": "58123", "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": "58070", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "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": "59174", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "176035", "key": "TIMOB-28340", "fields": { "summary": "TiAPI: Return Promise for Ti.UI.Window open() and close()", "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 } } } }, { "id": "59141", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "176011", "key": "TIMOB-28332", "fields": { "summary": "TiAPI: Make APIs available via JS classes", "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 } } } } ], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-02-08T18:58:39.000+0000", "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" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" }, { "id": "10206", "name": "iOS", "description": "iOS Platform" }, { "id": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "*Motivation*\r\nAs we are moving forward to support more ES6 sugar in Titanium, the legacy namespace-based API's have served well but need to be replaced by a more modern approach. \r\n\r\n*Challenges*\r\nWe have to think about both the core and native modules and validate whether this actually needs to be a breaking change for modules, as most of the work will be done in the require-handling and kroll-invocation.\r\n\r\n*Example*\r\n\r\nBefore:\r\n{code:js}\r\nconst window = Ti.UI.createWindow({\r\n title: 'So legacy ...'\r\n});\r\n{code}\r\nAfter:\r\n{code:js}\r\nimport { Window } from 'titanium-core';\r\n// OR: import { Window } from 'titanium-ui';\r\n\r\nvar window = new Window({\r\n title: 'Beautiful new API!'\r\n});\r\n{code}\r\n\r\n*Roadmap*\r\nIf possible, we could introduce a require/import based approach for one of the next feature-versions, deprecate in the next major (8.0.0) and remove in the following major (9.0.0).\r\n\r\n*EDIT*: [~gmathews] did [Ti.ES6|https://github.com/appcelerator/ti.es6] earlier this year, which uses a similar approach, but requires a lot of \"metabase\"-like files in order to work.", "attachment": [], "flagged": false, "summary": "TiAPI: Deprecate Ti global namespace, move to require/import based API's", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "433987", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Typing \"titanium-\" is going to get repetitive. I don't even think we need to namespace since importing a module without a relative path will imply trying to load a built-in module (before scanning \"node_modules\").\r\n\r\n{code}\r\nimport { Window } from 'ui';\r\n{code}\r\n\r\nWe could also support something like this:\r\n\r\n{code}\r\nimport TextField, { INPUT_BORDERSTYLE_ROUNDED } from 'ui/text-field';\r\n{code}", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2018-02-02T23:54:28.000+0000", "updated": "2018-02-02T23:54:28.000+0000" }, { "id": "433992", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Maybe \r\n{code:js}\r\nimport { Window, Label, View } from { titanium };\r\n{code}\r\nI heard \"some other frameworks\" do it that way :P.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-03T10:41:22.000+0000", "updated": "2018-02-03T10:41:22.000+0000" }, { "id": "434036", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "I'm not certain I've ever seen that syntax. I don't see how that's an improvement on the above examples.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2018-02-05T08:10:04.000+0000", "updated": "2018-02-05T08:10:04.000+0000" }, { "id": "434039", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "I feel like it might be confusing to not prefix the imports as there are many (especially classic apps where we used to recommend a /ui/common etc require style. But if you work more on Node than I do, so I'd trust your opinion.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-05T08:25:19.000+0000", "updated": "2018-02-05T08:25:19.000+0000" }, { "id": "440581", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~cwilliams] Any thoughts on the import-design here? You worked on some similar approaches for the Hyperloop ES6 namespaces already, so you might have an idea. My latest proposal would be a mix of [~cbarber]'s approach and my initial one:\r\n{code:js}\r\n// Resolved internally to Ti.UI.TextField, Ti.UI.Button and Ti.UI.INPUT_BORDERSTYLE_ROUNDED\r\n// Note: INPUT_BORDERSTYLE_ROUNDED lives under Ti.UI, not Ti.UI.TextField\r\nimport TextField, Button, { INPUT_BORDERSTYLE_ROUNDED } from 'titanium/ui';\r\n{code}\r\nThat way, we could pretty much write a regex to map require-statements prefixed with {{titanium}} to look at the core-modules.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-08T15:11:14.000+0000", "updated": "2018-08-08T15:11:14.000+0000" }, { "id": "440582", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Again, typing \"titanium-\" is going to be repetitive. Secondly, we don't want a \"core\" module that exports the entire API. I'd be fine with a specific silo (e.g. ui, fs, etc). Just note that when \"ui\" exports all UI classes, it adds overhead and yet another place a class need to be registered/exported.\r\n\r\nIn my opinion, the following is how it should be:\r\n\r\n{code}\r\nimport Window from 'ti/ui/window';\r\n// or import { Window } from 'ti/ui';\r\n\r\nconst window = new Window({\r\n title: 'Beautiful new API!'\r\n});\r\n{code}", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2018-08-08T15:14:22.000+0000", "updated": "2018-08-08T15:14:22.000+0000" }, { "id": "440583", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "So you are complaining about {{titanium}} vs {{ti}}? I did not propose {{titanium-}} in the latest proposals.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-08-08T15:17:35.000+0000", "updated": "2018-08-08T15:17:35.000+0000" }, { "id": "440584", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Also, {{import}} implies it's loading a JavaScript module which is different than a CommonJS module. JavaScript module exports MUST be static and are loaded async. CommonJS module exports can be dynamic and are loaded sync. Node is solving this problem by introducing the {{.mjs}} file extension so that the loader can determine what it's loading.\r\n\r\nHow are you planning to support this? If we continue to use Babel to transform modules, then we'll be OK since it wraps all exports of every file. However, this would be a crutch and eventually we would get rid of Babel and natively support JavaScript modules and we'll have a big problem.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2018-08-08T15:20:34.000+0000", "updated": "2018-08-08T15:20:34.000+0000" }, { "id": "440585", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Yes, I'm saying we shouldn't make people type \"titanium-\" everywhere as the description in this issue currently suggests.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2018-08-08T15:21:22.000+0000", "updated": "2018-08-08T15:21:22.000+0000" }, { "id": "446321", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Note that I think Gary has made some real nice progress on this general idea in his ti.es6 project here: https://github.com/appcelerator/ti.es6", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2019-02-26T15:23:32.000+0000", "updated": "2019-02-26T15:23:32.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }