You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
978 B
41 lines
978 B
2 years ago
|
package com.fr.design.jxbrowser;
|
||
|
|
||
|
import com.fr.design.bridge.exec.JSExecutor;
|
||
|
import com.teamdev.jxbrowser.js.JsFunction;
|
||
|
import com.teamdev.jxbrowser.js.JsObject;
|
||
|
|
||
|
/**
|
||
|
* 用于 jxbrowser 执行后的回调执行器
|
||
|
* 适配7.15之后
|
||
|
*
|
||
|
* @author vito
|
||
|
* @since 11.0
|
||
|
* Created on 2023/6/8
|
||
|
*/
|
||
|
public class BrowserExecutor implements JSExecutor {
|
||
|
|
||
|
/**
|
||
|
* 创建一个回调执行器
|
||
|
*
|
||
|
* @param window js环境的window对象
|
||
|
* @param callback 回调
|
||
|
* @return 执行器
|
||
|
*/
|
||
|
public static BrowserExecutor create(JsObject window, JsFunction callback) {
|
||
|
return new BrowserExecutor(window, callback);
|
||
|
}
|
||
|
|
||
|
private final JsObject window;
|
||
|
private final JsFunction callback;
|
||
|
|
||
|
private BrowserExecutor(JsObject window, JsFunction callback) {
|
||
|
this.window = window;
|
||
|
this.callback = callback;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void executor(String newValue) {
|
||
|
callback.invoke(window, newValue);
|
||
|
}
|
||
|
}
|