[ALOY-112] Improve syntax of custom model functions
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2012-07-26T12:03:53.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2012 Sprint 15, Release 3.0.0 |
Components | Runtime, XML |
Labels | n/a |
Reporter | Tony Lukasavage |
Assignee | Unknown |
Created | 2012-07-18T10:37:27.000+0000 |
Updated | 2018-03-07T22:25:52.000+0000 |
Description
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.
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.
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.