本文整理汇总了Java中com.eclipsesource.v8.V8Array.get方法的典型用法代码示例。如果您正苦于以下问题:Java V8Array.get方法的具体用法?Java V8Array.get怎么用?Java V8Array.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.eclipsesource.v8.V8Array
的用法示例。
在下文中一共展示了V8Array.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initProcessExitCallback
import com.eclipsesource.v8.V8Array; //导入方法依赖的package包/类
private void initProcessExitCallback() {
JavaVoidCallback callbackProccessExit = new JavaVoidCallback() {
@Override
public void invoke(V8Object arg0, V8Array parameters) {
if (parameters.length() > 0) {
Object arg1 = parameters.get(0);
log.error("ProccessExit " + arg1);
// mV8rt.executeVoidScript("return \"\";");
}
}
};
mV8rt.registerJavaMethod(callbackProccessExit, "proccessExit");
mV8rt.executeVoidScript("var process = {\"exit\": function () { proccessExit(); } };");
}
示例2: initLogCallback
import com.eclipsesource.v8.V8Array; //导入方法依赖的package包/类
private void initLogCallback() {
JavaVoidCallback callbackLog = new JavaVoidCallback() {
@Override
public void invoke(V8Object arg0, V8Array parameters) {
if (parameters.length() > 0) {
Object arg1 = parameters.get(0);
log.debug("JSLOG " + arg1);
}
}
};
mV8rt.registerJavaMethod(callbackLog, "log");
mV8rt.executeVoidScript("var console = {\"log\":log, \"error\":log};");
}
示例3: convertArray
import com.eclipsesource.v8.V8Array; //导入方法依赖的package包/类
/**
* Recursively convert a V8 array to a list and release it
* @param arr the array to convert
* @return the list
*/
private List<Object> convertArray(V8Array arr) {
List<Object> l = new ArrayList<>();
for (int i = 0; i < arr.length(); ++i) {
Object o = arr.get(i);
if (o instanceof V8Array) {
o = convert((V8Array)o, List.class);
} else if (o instanceof V8Object) {
o = convert((V8Object)o, Map.class);
}
l.add(o);
}
return l;
}