{ "id": "61325", "key": "TIMOB-693", "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": [], "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2016-08-19T16:32:50.000+0000", "created": "2011-04-15T02:34:37.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "core" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-20T17:53:11.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": "If I try to include a JS in a function with Ti.include, I can't access the local scope of the function from the included js.\r\n\r\nIn the API documentation you wrote: \"one or more filenames to include as if the Javascript code was written in place.\" In this\r\nway it is not true.\r\n\r\nExample:\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Window 1',\r\n backgroundColor:'white',\r\n fullscreen:false\r\n});\r\n\r\nvar globalv = 1;\r\n\r\nfunction f1(){\r\n var v = 2;\r\n Ti.include('t2.js');\r\n}\r\n\r\nf1();\r\n\r\nwin1.open();\r\n{code}\r\n\r\n{code:lang=javascript|title=t2.js}\r\nTi.API.info(\"output of globalv is: \" + globalv); // this outputs 1, as expected\r\nTi.API.info(\"output of v is: \" + v); // this throws undefined exception, rather than the expected 2\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Ti.include in functions", "creator": { "name": "wallneradam", "key": "wallneradam", "displayName": "wallneradam", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "wallneradam", "key": "wallneradam", "displayName": "wallneradam", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "123834", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Unlikely include scenario, but should be investigated. Probably\nhas to do with JS context scope. At best, a documentation\nchange.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:34:37.000+0000", "updated": "2011-04-15T02:34:37.000+0000" }, { "id": "133725", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-05-16T12:43:08.000+0000", "updated": "2011-06-12T09:32:20.000+0000" }, { "id": "214061", "author": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "body": "Still able to reproduce this issue with the iOS simulator, TiSDK 2.2.0v20120810194112, TiStudio 2.1.1.201207271312.", "updateAuthor": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "created": "2012-08-13T10:46:45.000+0000", "updated": "2012-08-13T10:46:45.000+0000" }, { "id": "393622", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "{{ti.include()}} is deprecated since Titanium SDK 3.3.0 in favor of {{require()}}.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2016-08-19T16:32:50.000+0000", "updated": "2016-08-19T16:32:50.000+0000" }, { "id": "413845", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as ti.include() has been deprecated since Titanium SDK 3.3.0.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-20T17:53:11.000+0000", "updated": "2017-03-20T17:53:11.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }