Global

Object
Platform Since
Android 0.8
iPhone 0.8
iPad 0.8
Mobile Web 1.8

Summary

APIs that live in the global scope.

Description

Titanium provides a number of global built-in objects.

JSON

Titanium has a built-in JSON parser with two main functions: parse and stringify. JSON.parse will safely evaluate a string encoded as JavaScript into a JavaScript object. JSON.stringify will encode a JavaScript object into a string.

Timers

Titanium has built-in support for one-shot and repeating timers with two main functions: setTimeout and setInterval. setTimeout takes 2 arguments: function and timeout in milliseconds after which the function should be executed and returns a timer handle that can be used to cancel a pending timer with clearTimeout. setInterval takes 2 arguments: function and timeout in milliseconds for how often the function should be executed until cancelled and returns a timer handle that can be used to cancel a timer with clearInterval.

Alert

Titanium has a built-in convenience function alert which can be used as a shortcut to create and show a simple AlertDialog.

Locale

The macro L can also be used which aliases the method Titanium.Locale.getString.

Methods

Name Summary
L

An alias for Titanium.Locale.getString.

alert

Displays a pop-up alert dialog with the passed in message.

clearInterval

Clear an interval timer from being fired.

clearTimeout

Clear a timeout timer from being fired.

decodeURIComponent

Replaces each URI encoded escape sequence in the passed in encodedURI with the character that it represents.

encodeURIComponent

Replaces all URI special characters in the passed in string with URI escape codes.

require

Loads either a native Titanium module, or a CommonJS module.

setInterval

Creates an interval timer that calls function every delay milliseconds.

setTimeout

Creates a timer that calls function once after delay milliseconds.

Properties

This type has no properties.

Events

This type has no events.