Titanium

Module
Platform Since
Android 0.1
iPhone 0.1
iPad 0.1
Mobile Web 1.8

Summary

The top-level Titanium module.

Description

The Titanium module provides the Titanium Mobile API, allowing developers to access native features of each target environment. Currently, the Android, iOS and Mobile Web (beta) environments are supported.

Titanium Namespace

The complete Titanium API is accessible from the Titanium namespace but, for convenience and brevity, the alias Ti is also provided. As the Titanium namespace is functionally-identical to its Ti alias, it is always recommended to use Ti in your code.

For example, the following pairs of Titanium calls behave exactly the same.

Titanium.API.info('Hello Titanium!');
Ti.API.info('Hello Titanium!');
 
Titanium.Utils.sha256('Hello Titanium!');
Ti.Utils.sha256('Hello Titanium!');
 
Titanium.App.Properties.setString('hello_msg','Hello Titanium!');
Ti.App.Properties.setString('hello_msg','Hello Titanium!');
 
Titanium.Database.open('mydb');
Ti.Database.open('mydb');

Global APIs

Titanium includes a number of built-in JavaScript objects that are not part of the Titanium namespace, including JSON parsing, String formatting, timers, and the CommonJS require function. See Global APIs for details.

Objects

Name Summary
Titanium.Blob

The blob is an abstract data type that represents binary information, often obtained through HTTPClient or via files. It often is used to store text or the actual data of an image. (Android, iPhone, iPad only.)

Titanium.BlobStream

Wrapper around Titanium.Blob that implements the Titanium.IOStream interface (Android, iPhone, iPad only.)

Titanium.Buffer

Buffer is a container for raw data. A buffer is created by the method Titanium.createBuffer. (Android, iPhone, iPad only.)

Titanium.BufferStream

Wrapper around Titanium.Buffer that implements the Titanium.IOStream interface (Android, iPhone, iPad only.)

Titanium.Event

The base type for all Titanium events. (Android, iPhone, iPad only.)

Titanium.IOStream

IOStream is the interface that all stream types implement (Android, iPhone, iPad only.)

Methods

Name Summary
addEventListener

Adds the specified callback as an event listener for the named event.

createBuffer

Creates a new buffer based on the params. (Android, iPhone, iPad only.)

fireEvent

Fires a synthesized event to any registered listeners.

getBuildDate

Gets the value of the buildDate property.

getBuildHash

Gets the value of the buildHash property.

getUserAgent

Gets the value of the userAgent property.

getVersion

Gets the value of the version property.

include

Includes JavaScript code from one or more files.

removeEventListener

Removes the specified callback as an event listener for the named event.

setUserAgent

Sets the value of the userAgent property.

Properties

Name Type Summary
buildDate String

Date of the Titanium build. read-only

buildHash String

Git hash of the Titanium build. read-only

userAgent String

User-agent string used by Titanium.

version Number

Version of Titanium that is executing. read-only

Events

This type has no events.