[ALOY-400] Move Alloy properties (like globals, Collections, Models, CFG) into alloy.js instead of app.js
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | High |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2012-11-29T18:30:45.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 0.3.3, 2012 Sprint 24 |
Components | Runtime |
Labels | n/a |
Reporter | Tony Lukasavage |
Assignee | Unknown |
Created | 2012-11-28T23:32:04.000+0000 |
Updated | 2018-03-07T22:26:00.000+0000 |
Description
It makes more sense to organize standard properties for the Alloy namespace object within the runtime Alloy.js file, rather than initializing them in the app.js itself. For example, the app.js template:
/**
* Alloy for Titanium by Appcelerator
* This is generated code, DO NOT MODIFY - changes will be lost!
* Copyright (c) 2012 by Appcelerator, Inc.
*/
var Alloy = require('alloy'),
_ = require('alloy/underscore')._;
Alloy.Collections = {};
Alloy.globals = {};
Alloy.CFG = require('alloy/CFG');
<%= alloyJs %>
Alloy.createController('index');
Ideally, it will look like this, with all code that was removed placed in the actual runtime Resources/alloy.js library:
/**
* Alloy for Titanium by Appcelerator
* This is generated code, DO NOT MODIFY - changes will be lost!
* Copyright (c) 2012 by Appcelerator, Inc.
*/
var Alloy = require('alloy'),
_ = require('alloy/underscore')._;
<%= alloyJs %>
Alloy.createController('index');
All discussed changes have been made, organizing Alloy namespace relevant items in the alloy.js runtime file. In addition, updates have been made to the inline documentation which tells us how these namespaces and object works. They include samples and any deprecation notes.