Loading...
Loading...
Titanium Alloy CLI and configuration guide. Use when creating, reviewing, analyzing, or examining Alloy projects, running alloy commands (new, generate, compile), configuring alloy.jmk or config.json, debugging compilation errors, creating conditional views, using Backbone.Events for communication, or writing custom XML tags.
npx skill4agent add maccesar/titanium-sdk-skills alloy-howtosapp/alloy.jmkconfig.json| Topic | Reference |
|---|---|
| Best Practices & Naming Conventions | best_practices.md |
| CLI Commands (new, generate, compile) | cli_reference.md |
| Configuration Files (alloy.jmk, config.json) | config_files.md |
| Custom XML Tags & Reusable Components | custom_tags.md |
| Debugging & Common Errors | debugging_troubleshooting.md |
| Code Samples & Conditionals | samples.md |
__fooTi.App.fireEventTi.App.addEventListener// In alloy.js
Alloy.Events = _.clone(Backbone.Events);
// Listener
Alloy.Events.on('updateMainUI', refreshData);
// Clean up on close
$.controller.addEventListener('close', () => {
Alloy.Events.off('updateMainUI');
});
// Trigger
Alloy.Events.trigger('updateMainUI');const Alloy = require('alloy');
const Backbone = require('alloy/backbone');
const _ = require('alloy/underscore')._;if<Alloy>
<Window>
<View if="Alloy.Globals.isLoggedIn()" id="notLoggedIn">
<Label text="Not logged in" />
</View>
<View if="!Alloy.Globals.isLoggedIn()" id="loggedIn">
<Label text="Logged in" />
</View>
</Window>
</Alloy>"#info[if=Alloy.Globals.isIos7Plus]": {
font: { textStyle: Ti.UI.TEXT_STYLE_FOOTNOTE }
}<TableViewRow if="$model.shouldShowCommentRow()">| Error | Solution |
|---|---|
| Run |
| Android assets not showing | Use absolute paths (prepend |
| Add |
iOS | Creating Android-only object - use |
# New project
alloy new [path] [template]
# Generate components
alloy generate controller <name>
alloy generate model <name> <adapter> <schema>
alloy generate style --all
# Compile
alloy compile [--config platform=android,deploytype=test]
# Extract i18n strings
alloy extract-i18n en --apply
# Copy/move/remove controllers
alloy copy <old> <new>
alloy move <old> <new>
alloy remove <name>os:iosenv:productionglobalAlloy.CFG.yourKeyapp/lib/exports.createCheckBox = args => {
const wrapper = Ti.UI.createView({ layout: "horizontal", checked: false });
const box = Ti.UI.createView({ width: 15, height: 15, borderWidth: 1 });
// ... build component, return Ti.UI.* object
return wrapper;
};<CheckBox module="checkbox" id="terms" caption="I agree" onChange="onCheck" />moduleapp/lib/.jscreate<TagName>| Task | Use This Skill |
|---|---|
| Modern architecture, services, patterns | |
| Alloy MVC concepts, models, data binding | |
| SDK config, Hyperloop, app distribution | |