Home Notices Documents Classes Download Others Rice
Classes  >  jsexecutor  >  Invoke(string,...)
jsexecutor class : Invoke(string,...) method

Description

Invokes a JavaScript function by its name.

Syntax

jsexecutorInstance.Invoke(string funcName, ...)

Arguments

ClassNameDescription
stringfuncNameA JavaScript function name.
...Arguments passed to the JavaScript function.

Return value

ClassDescription
int,real,string, or boolIt has stored a return value from the JavaScript function.

Sample code

Suppose you have the following JavaScript function in currently displayed page.

1:

function square(number) {

2:

return number * number;.

3:

}

Usage of the Invoke(string,...) method is as follows.

1:

jsexecutor jse = new jsexecutor();

2:

string funcName = "square";

3:

int intRet = jse.Invoke(funcName, 5); // The return value is the int class, and its value is 25.

Notes

First argument should specify only a JavaScript function name. In the above case, the first argument is "square".

You can place the arguments required by the JavaScript function to the second and subsequent arguments. These arguments should be the int, long, real, string, or bool class.

There is no limit the number of second and subsequent arguments. You can place the arguments in the order required by the JavaScript function.


The return value from JavaScript function must be evaluable as the int, real, string, or bool.

If the return value from JavaScript function can not evaluate as the above classes, an empty proxy is returned.Fixed in Ver 1.0.0.1.

If the return value from the JavaScript function can be evaluated as the above class, the corresponding Rice class is returned. Otherwise, the void class is returned.

Links for reference

None.

Copyright © Rice All rights reserved.