- Install latest stable Alloy:
[sudo] npm install -g alloy
- Install Alloy by version:
[sudo] npm install -g [email protected]
- Alloy Documentation
- Alloy on NPM
The following changes alter the behavior of the Alloy Framework from previous versions and may require code changes to your applications.
Alloy 1.0 only supports Titanium SDK 3.0 and later. Previous versions of Alloy supported Titanium SDK 2.1.x and later.
For Alloy View proxies and Controllers, that is, objects either referenced with $.myid
or
created with createController
and getView
methods, you cannot use the Backbone Events
API on
, off
and trigger
methods to bind and unbind event callbacks, or fire events.
Use the Titanium SDK API addEventListener
, removeEventListener
and fireEvent
methods instead.
Previously, Alloy View proxies and Controllers could use the Backbone Events API.
For Alloy Collection and Model objects, use the Backbone Events API not the Titanium SDK event listener API. This has not changed from previous versions of Alloy.
Model-view binding with the Ti.UI.View proxy should be considered experimental. On the iOS platform, the view items are not being repopulated correctly. To follow this issue, see ALOY-485.
Model-view binding with TableViews works fine and does not suffer from any known issues.
For more information, see the Alloy Data Binding guide.
If you created a custom sync adapter, the order of the passed parameters of the
module.exports.sync
method
has changed to match the Backbone.sync
method.
Prior to 1.0.0, the order was:
module.exports.sync(model, method, options)
For 1.0.0 and later, the order is now:
module.exports.sync(method, model, options)
To update your custom sync adapter, just switch the order of the method
and model
arguments.
Additionally, both the module.exports.beforeModelCreate
and module.exports.afterModelCreate
methods accept an additional passed parameter--the name of the model file.
Prior to 1.0.0, the methods were:
module.exports.beforeModelCreate(config)
module.exports.afterModelCreate(Model)
For 1.0.0 and later, the methods are:
module.exports.beforeModelCreate(config, name)
module.exports.afterModelCreate(Model, name)
The previous sql
sync adapter has been replaced with the sql_new
sync adapter as mentioned in
release 0.3.5.
If you have a model that uses the sql
sync adapter from Alloy 0.3.6 and before, you need to
migrate
your data to the new table schema of the Alloy 1.0.0 SQLite sync adapter.
First, manually remove the following files from your Alloy project:
- Resources/alloy.js
- Resources/alloy/sync/sql.js
Next, create a one-time migration file to transfer your model data to the new database schema.
Adapt the following code for your table schema. Replace title
, author
and isbn
with your own specific table schema but leave id
and alloy_id
alone. The order of fields does matter.
This migration file creates a temporary table, copies your current data to a temporary table,
deletes the old table from the database, creates a new table, then copies your data to the new table.
migration.up = function(migrator) {
var db = migrator.db;
var table = migrator.table;
db.execute('CREATE TEMPORARY TABLE book_backup(title,author,isbn,alloy_id);')
db.execute('INSERT INTO book_backup SELECT title,author,isbn,id FROM ' + table + ';');
migrator.dropTable();
migrator.createTable({
columns: {
title:"TEXT",
author:"TEXT",
isbn:"INTEGER"
},
});
db.execute('INSERT INTO ' + table + ' SELECT title,author,isbn,alloy_id FROM book_backup;');
db.execute('DROP TABLE book_backup;');
};
migration.down = function(migrator) {
}
Run your application once to migrate your data, then remove the migration file.
Note the migrator.db
object in the previous example. This object is a handle to a Ti.Database
instance
to execute SQLite commands. DO NOT CLOSE THIS HANDLE OR OPEN A SECOND INSTANCE OF THE DATABASE.
This will cause fatal application errors.
See the Alloy Sync Adapters and Migrations guide for information about the new SQLite sync adapter and the new migration features.
The ti.physicalSizeCategory
module has been replaced by a background module part of Titanium SDK 3.0.x.
No action is needed to migrate to the new module. However, your tiapp.xml
file still references this module,
but does not affect the compilation or execution of the application. You may safely remove this reference from your
tiapp.xml
file.
Previously, this module was copied to an Alloy project as part of the alloy new
command
and used to determine the size of an Android device.
The following deprecated APIs have been removed in this release:
API | Type | Notes |
---|---|---|
Alloy.getCollection |
method | Creates a local instance of a collection. Use Alloy.createCollection instead. |
Alloy.getController |
method | Creates a local instance of a controller. Use Alloy.createController instead. |
Alloy.getModel |
method | Creates a local instance of a model. Use Alloy.createModel instead. |
Alloy.getWidget |
method | Creates a local instance of a widget. Use Alloy.createWidget instead. |
Alloy.globals |
property | Global namespace. Use Alloy.Globals instead. |
datatime.js |
builtin | Collection of functions for datetime formatting. Use moment.js instead. |
size |
XML/TSS attribute | Defines size-specific view components or styles. Use the formFactor attribute instead. |
- ALOY-343. Facilitate Alloy code completion in Studio.
- ALOY-437. Support Android fastdev.
- ALOY-475. Create test app for testing sql adapter apps with no migrations.
- ALOY-209. Remove ti.physicalSizeCategory module for Alloy 1.0.0 (TiSDK 3.0+). Fixes ALOY-188 and ALOY-134.
- ALOY-313. Use applyProperties to assign properties to Ti.Android.MenuItem in parser.
- ALOY-323. Make Alloy support only TiSDK 3.0+.
- ALOY-407. Make
alloy generate model
calls uniform in format, regardless of adapter. Fixes ALOY-375 where models were not being generated correctly in Titanium Studio. - ALOY-429. Convert jake app runner to use new CLI.
- ALOY-454. iOS is rebuilding apps every time with new CLI.
- ALOY-455. Remove Backbone eventing from Titanium proxies. Fixes ALOY-460 where ScrollableViews displayed noticeable lagging.
- ALOY-457. Make Alloy sync adapter sync() function signature match that of Backbone.
- ALOY-473. Abort compile process with message if trying to compile Alloy 1.0+ for anything less than Titanium 3.0.
- ALOY-476. Widgets within model-bound view get bound to unexisting
$model
. - ALOY-479. Fix migration processing bug.
- ALOY-480. Replace
sql
adapter withsql_new
. - ALOY-482. View-based collection binding not properly clearing children before repopulating.
- ALOY-486.
sql
adapter does not update ID in client-side model when using AUTOINCREMENT.
- ALOY-330. Make
alloy run
executetitanium build
. Thealloy run
command will be removed in version 1.1.0 in favor of only using thetitanium build
command of the Titanium CLI.
- ALOY-474. Allow extra commas in TSS files.
- Tons of sql sync adapter features and fixes
- IMPORTANT: Please read the notes on the sql_new adapter below.
- ALOY-458. The sql adapter now allows you to execute custom queries on fetch(). The models/sql_queries test app uses this, specifically in this controller file.
- ALOY-447. Alloy Model column definitions now support SQLite keywords, like PRIMARY KEY and AUTOINCREMENT. The models/sql_keywords test app shows how to use it.
- ALOY-467. idAttribute is now assignable from the model.js file's definition object. The models/sql_keywords test app, specifically this model file shows how to use it to identify which column in your table is the unique identifier for syncing between SQLite and Backbone.
- ALOY-453. Full support for up() and down() migrations in sql adapter. models/sql_keywords is also a multiple migration test app.
- ALOY-345. sql adapter databases can now be preloaded from a database file. The models/sql_preload test app shows how.
- ALOY-456. sql adapter now supports multiple SQLite databases. The model/sql_queries test app makes use of multiple SQLite databases.
- ALOY-468. Added insertRow() and deleteRow() functions to migration object. You can see these in use for prepopulating and deleting rows in this migration file of the models/sql_queries test app.
- TSS parsing and features
- ALOY-272. TSS parsing is now grammar based. Makes code assist in TiStudio possible.
- ALOY-252. Commas are now optional between top-level style objects in TSS files. Check this style file for an example.
- ALOY-452. expr() syntax has been removed from TSS files. Here is the cleaner and more powerful alternative for using runtime values in TSS files.
- ALOY-284. Titanium constants can now be used as XML attributes in markup. Check this view xml file for an example.
- ALOY-191. The models/todo test app now works with all supported sync adapters (sql, properties, localStorage).
- ALOY-336. Mobileweb logs not showing up in console (related to TISTUD-2525).
- ALOY-449. Parsing state not cleaned properly when processing multiple top-level UI elements.
- ALOY-446. sql adapter should open/close between all operations (best practices).
Due to the massive amount of changes in the sql adapter, it is being introduced as "sql_new". This is the "type" you would use in your model definitions, as seen in this model from the models/sql_queries test app. The unchanged "sql" adapter still exists temporarily for compatibility.
All freshly built apps will work with the sql_new adapter, including all the sql ones in the test/apps/models folder in the repo. There may be conflicts, though, if you attempt to just drop the sql_new adapter on an app that has been previously using the old sql adapter. This is because sql_new uses a different, smarter, less invasive means of identifying the unique id of your sql records, adding an "alloy_id" column only if absolutely necessary. If you can delete your existing sql storage and just rebuild it, then all you need to do is delete and then you can start using the sql_new adapter. If not, we'll have a migration guide soon.
One final important note is that the old sql adapter will be replaced with sql_new when Alloy 1.0.0 is released, tentatively scheduled for mid-February. This'll give you a month to try it out and migrate data if necessary. Any questions or concerns, hit me up at the google group.
- ALOY-432. Added $.destroy() function to all controllers. When using model/collection binding in a controller, you MUST call this when closing a controller to prevent potential memory leaks. This is especially true if your binding makes references to global models/collections. More detailed documentation on this point will be added to the Alloy Data Binding Guide very soon. (TEST APP)
- ALOY-394. Support collection binding on Views, allowing for arbitrary component repetition. (TEST APP)
- ALOY-103. Support model binding of models to discrete properties on UI components. (TEST APP)
- ALOY-382, ALOY-383. Support in markup for proxy properties, like rightNavButton, leftNavButton, titleControl, etc... (TEST APP)
- ALOY-387, ALOY-388. Support view (XML) and controller (JS) code completion in Titanium Studio.
- ALOY-421. Add moment.js as builtin. Deprecates datetime.s builtin.
- ALOY-342. Support '--platform' option with 'alloy generate' command to create platform-specific views and controllers.
- ALOY-359, ALOY-423. Improve buttongrid widget and fix a memory leak.
- ALOY-361. Fix a bug with style prioritization as it relates to the formFactor attribute.
- ALOY-420. Refactor TableView parser to allow model-bound tables to use proxy properties.
- ALOY-430. Collection binding now responds to the Backbone "reset" event.
- ALOY-433. Removed "unreachable code" warning in production Android builds.
- ALOY-436. Alloy compile failures will now abort the Titanium build process, as expected, with the Titanium 3.0+ SDK.
- ALOY-438. Fixed bug where the Backbone off() function on Titanium proxies created from markup was not working.
-
ALOY-104. Enable Model-View binding on TableViews. For more information, see the basic tableview_binding test app or the slightly more complete todo_binding sample app which shows how to do data filtering and transformations on bound data.
NOTE: This is brand new stuff with lots more functionality coming, so any feedback on the current state is very welcome. It's best to let us know at the Alloy google group.
-
ALOY-312. Update Underscore.js to version 1.4.2 and Backbone.js to minified production 0.9.2 version.
-
ALOY-373, ALOY-379. Add Collection tag in markup to create a singleton or instance(s) of a collection.
-
ALOY-390, ALOY-391. Add Model tag in markup to create a singleton or instance(s) of a model.
-
ALOY-396, ALOY-397, ALOY-156. Add completion callback to all methods in the animation.js builtin library.
- ALOY-311. Improve Ti.UI.Android.MenuItem parser.
- ALOY-370. Fix ability to assign functions with variable assigned functions in controllers.
- ALOY-376. Improve handling of Ti.Android.Menu component.
- ALOY-393. (Re-)enable optimizer.js as part of runtime JavaScript file optimization.
- ALOY-403. Improve Alloy.Collection and Alloy.Model code optimization.
- ALOY-417. Improve properties adapter.
- ALOY-401. Deprecate Alloy.globals; use Alloy.Globals instead.
- ALOY-353. Support all Backbone eventing in Titanium proxies, on(), off(), trigger(). Fixed multiple event firing bug with on().
- ALOY-355. Improve path handling in compiler plugin for OS X.
- ALOY-356. Remove string builtin dependency to shorten compilation time.
- ALOY-365. Add Alloy.globals namespace for global context.
- ALOY-380. Create app/alloy.js file automatically for all new projects.
- ALOY-192. Add to-do sample application. Code is available on github.
- ALOY-337. Support themes to change the appearance of the entire GUI by customizing styles and assets. For more information, see:
- ALOY-306. Support platform, formFactor, and inline event attributes with abstract types in markup.
- ALOY-340. Fix Android "too deep recursion while parsing" error with Rhino runtime.
- ALOY-341. Improve adapter-backbone processing.
- ALOY-352. Fix SQL adapter to work if no migrations are present.
- ALOY-354. Fix "alloy generate jmk" command.
- Removed node-appc dependency.
- Added Alloy splash screens and icons
- Updated widgets, added new button-grid widget.
- Ti.UI.OptionDialog markup parser added. Check out this link for a test app and usage: https://github.com/appcelerator/alloy/tree/master/test/apps/ui/optiondialog
- You can get the Alloy version at runtime now with
Alloy.version
- Tightened up XML ID restrictions. As an enforced best practice, no reserved JS words as IDs. If you try to, you'll get a compile time error message.
- Revamp of code processing, better organized, more efficient. It's all under the hood, you shouldn't notice, other than compiles might be faster.
- Quick fix to error output in compiler plugin.py
- Some minor cleanup in the test apps