{ "id": "144604", "key": "TIMOB-18563", "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": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2015-02-13T01:47:35.000+0000", "created": "2015-02-12T23:41:23.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-24T17:09:38.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": "JSObject cannot be used in a concurrency::task().then callback without statically casting it back to a non-const.\r\n\r\n*Examples*\r\n{code}\r\nJSValue GeolocationModule::forwardGeocoder(const std::string& address, JSObject callback) TITANIUM_NOEXCEPT\r\n{\r\n\t...\r\n\r\n\tconcurrency::create_task(httpClient->GetAsync(requestUri)).then([this, address, callback](HttpResponseMessage^ response) {\r\n\t\t\r\n\t\t...\r\n\r\n\t\tTITANIUM_ASSERT(callback.IsFunction());\r\n\r\n\t\t// I would need to statically cast callback as a non-const\r\n\t\t// JSObject to be able to use it\r\n\t\tcallback({forwardGeocodeResponse}, get_context().get_global_object());\r\n\t});\r\n\r\n return get_context().CreateUndefined();\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "HAL: const JSObject cannot be used in concurrency::task().then", "creator": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "343213", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "You can use \"&\" to pass it as reference to lambda like \"&callback\" in this case.\r\n\r\n{code}\r\n concurrency::create_task(httpClient->GetAsync(requestUri)).then([this, address, &callback](HttpResponseMessage^ response) {\r\n TITANIUM_ASSERT(callback.IsFunction());\r\n callback({forwardGeocodeResponse}, get_context().get_global_object());\r\n });\r\n{code}\r\n", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-02-13T01:47:35.000+0000", "updated": "2015-02-13T01:47:35.000+0000" }, { "id": "415562", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-24T17:09:38.000+0000", "updated": "2017-03-24T17:09:38.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }