org.appcelerator.kroll.annotations
Annotation Type Kroll.method


@Documented
@Retention
@Target
public static @interface Kroll.method

Declares a method to be exposed as part of this Kroll.proxy or Kroll.module.

Methods may optionally make their first argument a KrollInvocation object, and may also declare optional arguments.

Example:
 @Kroll.method
 public void execute(String action, @Kroll.argument(optional=true) KrollDict options) {
 }
 

See Also:
name(), runOnUiThread(), @Kroll.argument

Optional Element Summary
 String name
          The method's name in the API.
 boolean runOnUiThread
          When set to true, this method will run on the UI thread, blocking the current thread until it finishes executing.
 

name

public abstract String name
The method's name in the API.

Default Value:
The method's name in Java source.
Default:
"__default_name__"

runOnUiThread

public abstract boolean runOnUiThread

When set to true, this method will run on the UI thread, blocking the current thread until it finishes executing. If the current thread is the UI thread, then this simply calls the method directly. This is functionally equivalent to:

 if (TiApplication.getInstance().isUIThread()) {
     return callMethod();
 } else {
     final AsyncResult result = new AsyncResult();
     getActivity().runOnUiThread(new Runnable() {
         public void run() {
             result.setResult(callMethod());
         }
     });
     return result.getResult();
 }
 

Default:
false


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