org.appcelerator.kroll
Class KrollRuntime

java.lang.Object
  extended by org.appcelerator.kroll.KrollRuntime
All Implemented Interfaces:
Handler.Callback

public abstract class KrollRuntime
extends Object
implements Handler.Callback

The common Javascript runtime instance that Titanium interacts with. The runtime instance itself is static and lives with the Android process. KrollRuntime use activity reference counting to tear down the runtime state when all of the application's Titanium activities have been destroyed. Even after all of the activities have been destroyed, Android can (and usually does) keep the application process running. When the application is re-entered from this "torn down" state, we simply re-initialize again, this time from the first activity ref increment (TiBaseActivity.onCreate), instead of TiApplication.onCreate


Method Summary
static void addAdditionalExceptionHandler(KrollExceptionHandler handler, String key)
          Adds an exception handler to a list of handlers that will be called in addition to the default one.
static void removeExceptionHandler(String key)
          Removes the exception handler from the list of additional handlers.
static void setPrimaryExceptionHandler(KrollExceptionHandler handler)
          Sets the default exception handler for the runtime.
 

Method Detail

setPrimaryExceptionHandler

public static void setPrimaryExceptionHandler(KrollExceptionHandler handler)
Sets the default exception handler for the runtime. There can only be one default exception handler set at a time.

Parameters:
handler - The exception handler to set

addAdditionalExceptionHandler

public static void addAdditionalExceptionHandler(KrollExceptionHandler handler,
                                                 String key)
Adds an exception handler to a list of handlers that will be called in addition to the default one. To replace the default exception, use setPrimaryExceptionHandler(KrollExceptionHandler).

Parameters:
handler - The exception handler to set
key - The key for the exception handler

removeExceptionHandler

public static void removeExceptionHandler(String key)
Removes the exception handler from the list of additional handlers. This will not affect the default handler.

Parameters:
key - The key for the exception handler


Copyright © 2010-2012 Appcelerator, Inc. Licensed under the Apache License 2.0