Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Titanium Shortcuts

wGEric edited this page Sep 30, 2011 · 4 revisions

TiQuery provides many shortcuts for Titanium methods.

Logging

Below are the ways to do it in Titanium and the equivalent methods in TiQuery. The arguments are the same as they are for Titanium. See Titanium's Documentation for more information.

Titanium Code

Titanium.API.info('string');
Titanium.API.error('string');
Titanium.API.warn('string');
Titanium.API.log('level', 'string');

TiQuery

$.log('string');
$.error('string');
$.warn(string);
$.log('level', 'string');

create* Methods

There are shortcuts for just about every create* method that can be found in Titanium. The TiQuery equivalent methods take the same arguments as Titanium. Here are some more popular ones:

Titanium

Titanium.UI.createView();
Titanium.UI.createLabel();
Titanium.UI.createWindow();
Titanium.UI.createScrollView();
Tianium.Media.createVideoPlayer();

TiQuery

$.View();
$.Label();
$.Window();
$.ScrollView()
$.VideoPlayer();

NOTE: Titanium optimizes which classes it includes so that only those that you are using are included in the build. If you use the shortcuts below you'll need to tell Titanium to include these classes. You can do this by putting code like this in app.js

// make sure Titanium includes these classes when it builds the project
Titanium.UI.view;
Titanium.Media.VideoPlayer;

Here is the complete list of shortcuts:

Android

Contacts

Facebook

Filesystem

Map

Media

Network

Platform

Stream

UI