You are reading 13.0.1. See this page in 13.4.1.
Titanium
Extends Titanium.ModuleTitanium.Proxy
The top-level Titanium module.
The Titanium module provides the Titanium Mobile API, allowing developers to access native features of each target environment. Currently, the Android and iOSenvironments 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 String formatting, timers, and the CommonJS require function.
See Global APIs for details.
Properties 7
Inherited from Titanium.Proxy
The name of the API that this proxy corresponds to.
Inherited from Titanium.Proxy
Indicates if the proxy will bubble an event to its parent.
Default: true
Date of the Titanium build.
Git hash of the Titanium build.
Inherited from Titanium.Proxy
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
userAgent
StringUser-agent string used by Titanium.
Version of Titanium that is executing.
Methods 5
Inherited from Titanium.Proxy
Adds the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to invoke when the event is fired. 4 fields
|
applyProperties
since 3.0.0Inherited from Titanium.Proxy
Applies the properties to the proxy.
| Parameters | Type | Description |
|---|---|---|
| props | Dictionary | A dictionary of properties to apply. |
Creates a new buffer based on the params.
Create a buffer with 1K bytes
var buffer = Ti.createBuffer({ length: 1024 });
Create a buffer with string
Create a buffer with the string "hello world" encoded in UTF-8
var buffer = Ti.createBuffer({ value: "hello world" });
Create a buffer with encoded float
Create a buffer with the encoded value of the double-precision floating point number 1.234567 in Big Endian (network) byte order
var buffer = Ti.createBuffer({ value: 1.234567, type: Ti.Codec.TYPE_DOUBLE, byteOrder: Ti.Codec.BIG_ENDIAN });
| Parameters | Type | Description |
|---|---|---|
| params | CreateBufferArgs | creation arguments 4 fields
|
Inherited from Titanium.Proxy
Fires a synthesized event to any registered listeners.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| event? | Dictionary | A dictionary of keys and values to add to the Titanium.Event object sent to the listeners. |
Inherited from Titanium.Proxy
Removes the specified callback as an event listener for the named event.
| Parameters | Type | Description |
|---|---|---|
| name | String | Name of the event. |
| callback | Callback<Titanium.Event> | Callback function to remove. Must be the same function passed to 4 fields
|