Titanium JIRA Archive
Alloy (ALOY)

[ALOY-112] Improve syntax of custom model functions

GitHub Issuen/a
Resolution Date2012-07-26T12:03:53.000+0000
Affected Version/sn/a
Fix Version/s2012 Sprint 15, Release 3.0.0
ComponentsRuntime, XML
ReporterTony Lukasavage


Currently the custom model function syntax requires an anonymous Javascript function to be housed in a "js" file as the same name as the model "json" file. It typically looks like this:
function(Model) {
    // do stuff to model
    return Model;
The anonymous function syntax causes a syntax error in TiStudio because an anonymous function alone is not valid Javascript syntax. We need to modify the custom model template and function to prevent this.


  1. Russell McMahon 2012-07-23

    There are a couple solution. One I think one is not to use anonymous and perhaps return a var. Another solutions is to use a custom extension. The priority of this is high because it makes Alloy projects look messed up, although there is actually no problem in generation/parser.
  2. Tony Lukasavage 2012-07-23

    we definitely don't need a custom extension, it's just JS. It's a little more complicated than just return a var, but not too much. I'll have to modify the template as well as the syntax in the definition.

JSON Source