Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19084] Windows: _ undefined in Alloy apps

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-08-14T18:25:42.000+0000
Affected Version/sRelease 4.1.0
Fix Version/sRelease 5.0.0
ComponentsWindows
Labelsn/a
ReporterChristopher Williams
AssigneeKota Iguchi
Created2015-06-26T19:43:47.000+0000
Updated2015-09-07T14:02:30.000+0000

Description

When trying out the RSS reader sample, it is now failing due to the "_" variable being undefined during the parsing of the XML feed. Alloy has underscore inside it, and presumably exports _ globally for use. This works fine on iOS. My guess is that the context for some of this code is wrong and we're losing the definition of _ somewhere along the line?

Comments

  1. Christopher Williams 2015-06-26

    This may be specific to the RSS reader sample code. It's possible that the other platforms are actually "bleeding" some things into the global context when they shouldn't. Specifically https://github.com/appcelerator-developer-relations/Sample.RSS/blob/stable/app/lib/alloy/sync/rss.js There's no require to bring in underscore. If I add the following to the second line, it works:
       var _ = require("alloy/underscore")._;
       
  2. Christopher Williams 2015-07-08

    This was specific to the RSS sample app. Not convinced it's a specific issue with WIndows SDK.
  3. Kota Iguchi 2015-08-14

    https://github.com/appcelerator/titanium_mobile_windows/pull/402
  4. Ewan Harris 2015-09-07

    Verified using: Windows 8.1 Appc CLI Core: 5.0.0-33 Appc CLI NPM: 4.2.0-1 Titanium SDK: 5.0.0.v20150906220721 Nokia Lumia 930 8.1 RSS reader sample from https://github.com/appcelerator-developer-relations/Sample.RSS/pull/19 When removing [this line](https://github.com/appcelerator-developer-relations/Sample.RSS/pull/19/files#diff-8e4d796c00cf0dc7444dfac71d46e5f4R3) the app runs as expected Closing ticket

JSON Source