Titanium.API

module
0.2.0
A module for holding core Titanium functionality.

Objects

Application An object representing a Titanium application, either the currently running application or one on disk.
Component An object representing a Titanium component, which may be either a module, runtime, SDK, Mobile SDK or application update.
Dependency An object representing a Titanium application dependency.
Script Script object.

Functions

addEventListener Register a root event listener. Event listeners registered using this function will receive all events from Titanium.
createBlob Create a Kroll Blob object given a String. A Blob object is a generic way of holding a String of bytes.
createDependency A constructor for API.Dependency objects.
createKList Create a Kroll list given an optional JavaScript array. This method is mainly used for testing.
createKMethod Create a Kroll method given an existing JavaScript Funtion. This method is mainly used for testing.
createKObject Create a Kroll object given an existing JavaScript Object. This method is mainly used for testing.
critical Log a statement with CRITICAL severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
debug Log a statement with DEBUG severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
error Log a statement with ERROR severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
fatal Log a statement with FATAL severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
fireEvent Fire an event to the top-level event listener.
get Get an attribute in the global object
getApplication Get the currently running application. This application will should have all of its dependencies resolved.
getComponentSearchPaths Get a list of the paths on which Titanium searches for installed components. This does not include paths of bundled components.
getEnvironment Get the system environment object, which can be queried and updated just by accessing or setting its properties.
getInstalledComponents Get a list of the currently installed Titanium components. An installed component is one that has been found on the list of paths returned by Titanium.API.getComponentSearchPaths. This list does not include bundled components.
getInstalledMobileSDKs Get a list of the currently installed Titanium Mobile SDK components. An installed component is one that has been found on the list of paths returned by Titanium.API.getComponentSearchPaths. This list does not include bundled components.
getInstalledModules Get a list of the currently installed Titanium module components. An installed component is one that has been found on the list of paths returned by Titanium.API.getComponentSearchPaths. This list does not include bundled components.
getInstalledRuntimes Get a list of the currently installed Titanium runtime components. An installed component is one that has been found on the list of paths returned by Titanium.API.getComponentSearchPaths. This list does not include bundled components.
getInstalledSDKs Get a list of the currently installed Titanium SDK components. An installed component is one that has been found on the list of paths returned by Titanium.API.getComponentSearchPaths. This list does not include bundled components.
getLogLevel Get the log level threshold of the Titanium logger. The logger will log statements with this severity or one that is more severe. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
info Log a statement with INFO severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
installDependencies Invoke the installer to find and install a list of dependencies. When the installer is finished running, it will call the given callback. The only way to determine whether or not the installation was successful at this point is to try to resolve the dependencies that were passed to the installer. Currently the installer only supports Titanium.API.EQ dependencies.
log Log a statement with a given severity level. The severity levels are defined as constants on the API module. In order from least severe to most severe, they are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. WARN
  5. ERROR
  6. CRITICAL
  7. FATAL
notice Log a statement with NOTICE severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
print Print a String to stdout without a trailing newline
readApplicationManifest Read an application manifest at a given path and return an Titanium.API.Application object representing the application.
removeEventListener Remove a root event listener. If no listener with the given id or funtion is registered for this object, the call will do nothing.
runOnMainThread Execute the method asynchronously on the main thread. This should be used when attempting to run JavaScript methods from non-JavaScript threads. This method blocks until the function finishes executing and returns the return value of the method passed.
runOnMainThreadAsync Execute the method asynchronously on the main thread. This should be used when attempting to run JavaScript methods from non-JavaScript threads. This method does not wait for the method to complete and returns immediately.
set Set an attribute in the global object
setLogLevel Set the log level threshold of the Titanium logger. The logger will log statements with this severity or one that is more severe. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
trace Log a statement with TRACE severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
warn Log a statement with WARN severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL

Properties

Type Name Description
Number APP_UPDATE A constant representing an application update component type.
Number CRITICAL A constant representing CRITICAL logger severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
Number DEBUG A constant representing DEBUG logger severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
Number EQ A constant representing an equality dependency. This is used to specify resolutions to Titanium application dependencies.
Number ERROR A constant representing ERROR logger severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
Number FATAL A constant representing FATAL logger severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
Number GT A constant representing an greater-than dependency. This is used to specify resolutions to Titanium application dependencies.
Number GTE A constant representing an greater-than-or-equal-to dependency. This is used to specify resolutions to Titanium application dependencies.
Number INFO A constant representing INFO logger severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
Number LT A constant representing an less-than dependency. This is used to specify resolutions to Titanium application dependencies.
Number LTE A constant representing an less-than-or-equal-to dependency. This is used to specify resolutions to Titanium application dependencies.
Number MOBILESDK a constant representing a Mobile SDK component type.
Number MODULE A constant representing a module component type.
Number NOTICE A constant representing NOTICE logger severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
Number RUNTIME A constant representing a runtime component type.
Number SDK a constant representing an SDK component type.
Number TRACE A constant representing TRACE logger severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL
Number UNKNOWN a constant representing an UNKNOWN component type.
Number WARN A constant representing WARN logger severity. The severity levels in order from least severe to most severe are:
  1. TRACE
  2. DEBUG
  3. INFO
  4. NOTICE
  5. WARN
  6. ERROR
  7. CRITICAL
  8. FATAL