{ "id": "167185", "key": "TIMOB-24595", "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": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-05-01T18:22:54.000+0000", "created": "2017-04-19T05:58:20.000+0000", "epic": { "id": 162541, "key": "TIMOB-23765", "name": "Hyperloop for Windows", "summary": "Windows: Direct API Access not working ", "color": { "key": "color_1" }, "done": false }, "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" }, { "id": "19101", "name": "Hyperloop 2.1.0", "archived": false, "released": true, "releaseDate": "2017-04-28" } ], "issuelinks": [ { "id": "54753", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "inwardIssue": { "id": "164375", "key": "TIMOB-24099", "fields": { "summary": "Windows: Mix WinRT APIs with Titanium APIs", "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": "Medium", "id": "3" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } }, { "id": "54745", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "167226", "key": "TIMOB-24612", "fields": { "summary": "Windows: Native-like event handling syntax for Hyperloop", "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": "Medium", "id": "3" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } }, { "id": "54836", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "167257", "key": "TIMOB-24618", "fields": { "summary": "Windows: Replace uglify usage in build process", "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": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-05-05T19:22:05.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": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "Use of Hyperloop {{addEventListener}} throws \"unknow exception\".\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({ backgroundColor: 'green' }),\r\n Button = require('Windows.UI.Xaml.Controls.Button'),\r\n button = new Button();\r\n\r\nbutton.Content = \"PUSH\";\r\nbutton.addEventListener('Tapped', function (e) {\r\n alert('pushed');\r\n});\r\n\r\nwin.add(button);\r\nwin.open();\r\n{code}\r\n\r\n*Expected*\r\nPushing \"PUSH\" button should show \"pushed\" dialog.\r\n\r\n*Note*\r\nAfter some investigation, I found that at some point of Titanium SDK update, we updated {{uglify-js}} but it looks like it contains breaking changes. Uglify-js doesn't resolve constructor ({{init}} property of {{AST_Symbol}} on its [scope analyzer|http://lisperator.net/uglifyjs/scope]. It looks like there was breaking changes there, maybe from uglify-js 2.8.x, because I saw uglify-js 2.7.x (Titanium SDK {{6.1.0.v20170315131319}}) worked fine.\r\n", "attachment": [], "flagged": false, "summary": "Windows: Hyperloop addEventListener doesn't work", "creator": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 883, "state": "closed", "name": "2017 Sprint 09 SDK", "startDate": "2017-04-23T21:46:54.309Z", "endDate": "2017-05-07T21:46:00.000Z", "completeDate": "2017-05-08T00:25:44.276Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "417638", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "This is sample code to show the breaking-changes between {{uglify-js@2.7.0}} and {{uglify-js@2.8.21}}\r\n\r\n{code}\r\nvar UglifyJS = require('uglify-js'),\r\n topLevel = UglifyJS.parse('var A = require(\"We.should.resolve.this\"), a = new A(); a.addEventListener();');\r\n\r\ntopLevel.figure_out_scope();\r\n\r\nvar walker = new UglifyJS.TreeWalker(function(node) {\r\n if (node instanceof UglifyJS.AST_Call && node.expression.property == 'addEventListener') {\r\n console.log(node.expression.expression.thedef.init);\r\n }\r\n});\r\n\r\ntopLevel.walk(walker);\r\n{code}\r\n\r\n*uglify-js@2.7.0 (Titanium SDK 6.1.0.v20170315131319)*\r\n\r\n{code}\r\nAST_Node {\r\n end: \r\n AST_Token {\r\n raw: undefined,\r\n file: null,\r\n comments_before: [],\r\n nlb: false,\r\n endpos: 54,\r\n endcol: 54,\r\n endline: 1,\r\n pos: 53,\r\n col: 53,\r\n line: 1,\r\n value: ')',\r\n type: 'punc' },\r\n start: \r\n AST_Token {\r\n raw: undefined,\r\n file: null,\r\n comments_before: [],\r\n nlb: false,\r\n endpos: 50,\r\n endcol: 50,\r\n endline: 1,\r\n pos: 47,\r\n col: 47,\r\n line: 1,\r\n value: 'new',\r\n type: 'operator' },\r\n args: [],\r\n expression: \r\n AST_Node {\r\n end: \r\n AST_Token {\r\n raw: undefined,\r\n file: null,\r\n comments_before: [],\r\n nlb: false,\r\n endpos: 52,\r\n endcol: 52,\r\n endline: 1,\r\n pos: 51,\r\n col: 51,\r\n line: 1,\r\n value: 'A',\r\n type: 'name' },\r\n start: \r\n AST_Token {\r\n raw: undefined,\r\n file: null,\r\n comments_before: [],\r\n nlb: false,\r\n endpos: 52,\r\n endcol: 52,\r\n endline: 1,\r\n pos: 51,\r\n col: 51,\r\n line: 1,\r\n value: 'A',\r\n type: 'name' },\r\n thedef: \r\n { name: 'A',\r\n orig: [Object],\r\n scope: [Object],\r\n references: [Object],\r\n global: true,\r\n mangled_name: null,\r\n undeclared: false,\r\n constant: undefined,\r\n index: 0,\r\n id: 1,\r\n init: [Object] },\r\n name: 'A',\r\n scope: \r\n AST_Node {\r\n end: [Object],\r\n start: [Object],\r\n body: [Object],\r\n cname: -1,\r\n enclosed: [Object],\r\n parent_scope: null,\r\n uses_eval: false,\r\n uses_with: false,\r\n functions: [Object],\r\n variables: [Object],\r\n directives: undefined,\r\n globals: [Object],\r\n nesting: 0 },\r\n frame: 0 } }\r\n{code}\r\n\r\n*uglify-js@2.8.21 (Titanium SDK 6.1.0.v20170417190415)*\r\n\r\n{code}\r\nundefined\r\n{code}", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-04-19T06:41:01.000+0000", "updated": "2017-04-19T06:43:09.000+0000" }, { "id": "417646", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "We should *not* use any of the Titanium API's in Hyperloop, I hope this was the only case. Instead of using {{addEventListener}}, {{removeEventListener}} etc, the developer expects to use the native event handling instead (delegates on iOS, callbacks on Android, etc.). Or do I understand this wrong?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-19T11:50:37.000+0000", "updated": "2017-04-19T11:50:37.000+0000" }, { "id": "417651", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{quote}\r\n> developer expects to use the native event handling instead\r\n{quote}\r\n\r\nWe've been enabling {{addEventListener/removeEventListener}} on Hyperloop for Windows. (See also [Windows Runtime Direct API Access Event Handling|http://docs.appcelerator.com/platform/latest/#!/guide/Windows_Runtime_Direct_API_Access-section-src-43315893_WindowsRuntimeDirectAPIAccess-EventHandling]). \r\n\r\nBut yes, this should be an interesting point to discuss. Basically on Windows, C\\+\\+/CX uses {{+=}} to represent \"add event listener\" function like below. But the question is, do we have better style to represent this in JavaScript syntax?\r\n\r\n{code:title=C++/CX}\r\nclick_event_ = component->Tapped += ref new TappedEventHandler([this, ctx](Platform::Object^ sender, TappedRoutedEventArgs^ e) {\r\n // do something\r\n});\r\n{code}\r\n\r\nCurrently we've been using {{addEventListener}} for this like below.\r\n\r\n{code:title=JavaScript}\r\ncomponent.addEventListener('Tapped', function(e) {\r\n // do something\r\n});\r\n{code}\r\n\r\nI was thinking {{addEventListener}} can be more familiar for JavaScript developers.\r\n\r\nWe could do like below, regarding following C\\+\\+ syntax...but is this better?\r\n\r\n{code:title=JavaScript}\r\ncomponent.Tapped += function(e) {\r\n // do something\r\n};\r\n\r\nOr...?\r\n\r\ncomponent.Tapped += new TappedEventHandler(function(e) {\r\n // do something\r\n});\r\n{code}\r\n\r\nWe could have better way to do this, any suggestions would be appreciated! (on)", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-04-19T12:40:12.000+0000", "updated": "2017-04-19T12:41:03.000+0000" }, { "id": "417652", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Puuh, yeah the syntax is really hard to map to JavaScript. How we do we handle the same syntax for other class usages?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-19T13:17:27.000+0000", "updated": "2017-04-19T13:17:27.000+0000" }, { "id": "417653", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "We just basically maps C\\+\\+/CX {{ref new}} with JavaScript {{new}}. Use of {{+=}} for adding event listener is kind of special syntax in C\\+\\+/CX. ", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-04-19T13:47:26.000+0000", "updated": "2017-04-19T13:47:43.000+0000" }, { "id": "417655", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Yeah, the += could be misunderstood in JavaScript. I personally do like\r\n{code:js}\r\ncomponent.Tapped = new TappedEventHandler(function(e) {\r\n // do something\r\n});\r\n{code}\r\nbut only if people will understand it and you would agree. It looks like the closest syntax without interfering using custom/non-native methods. You decide! :-)", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-19T13:50:31.000+0000", "updated": "2017-04-19T13:50:31.000+0000" }, { "id": "417814", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I would prefer {{+=}} because it clearly indicates we are \"adding\" something. ({{=}} actually means different behavior (assign) on C# & C\\+\\+). I've create TIMOB-24612, because this new syntax is not going to happen on release 2.1.0.\r\n\r\n{code}\r\ncomponent.Tapped += new TappedEventHandler(function(e) {\r\n // do something\r\n})\r\n{code}", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-04-21T01:16:44.000+0000", "updated": "2017-04-21T01:16:44.000+0000" }, { "id": "417879", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "https://github.com/appcelerator/titanium_mobile_windows/pull/974", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-04-22T06:43:48.000+0000", "updated": "2017-04-22T06:43:48.000+0000" }, { "id": "417885", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~kota] Removing from \"Hyperloop 2.1.0\" milestone, since it's an SDK-PR.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-04-22T22:56:21.000+0000", "updated": "2017-04-22T22:56:21.000+0000" }, { "id": "418547", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified - https://github.com/appcelerator/titanium_mobile_windows/pull/974#pullrequestreview-35609940", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-05-02T02:13:05.000+0000", "updated": "2017-05-02T02:13:05.000+0000" }, { "id": "418661", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Fix can be viewed in 6.2.0.v20170501192357 and 6.1.0.v20170501130025", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-05-02T18:19:09.000+0000", "updated": "2017-05-02T18:19:09.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }