Titanium JIRA Archive
Alloy (ALOY)

[ALOY-370] In order to assign functions to exports object in controller - you must declare a local function vs a variable assigned function

GitHub Issuen/a
TypeBug
PriorityLow
StatusResolved
ResolutionFixed
Resolution Date2012-11-26T17:47:22.000+0000
Affected Version/sAlloy 0.3.1
Fix Version/sAlloy 0.3.3, 2012 Sprint 24
Componentsn/a
Labelsn/a
ReporterBert Grantges
AssigneeUnknown
Created2012-11-07T18:53:51.000+0000
Updated2018-03-07T22:26:08.000+0000

Description

The below does not work: var myFunc = function(){alert("hi there")}; exports.myFunc = myFunc; The below works: function myFunc2(){ alert("Hello Again")}; exports.myFunc2 = myFunc2; The issues is during the code generation, Alloy doesn't recognized variable assigned functions the same way it recognizes local functions. The result is that the generated code to assign the exports object is actually placed before the variable assigned function statement, leading to an undefined exports property.

Comments

  1. Tony Lukasavage 2012-11-26

    Required change in runtime controller composition. Test case works now, as do the alloy test apps that rely on this behavior.

JSON Source