1 Star 2 Fork 4

金学宁/autojs-webView

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
bridgeHandler.js 698 Bytes
一键复制 编辑 原始数据 按行查看 历史
xxxbin 提交于 4年前 . handle fun run 2 times
/** jsBridge交互处理逻辑实现 */
module.exports = {
handle: handle,
// 注册被调用方法,名称命名: cmd
toast: toastAction
}
/**
* 命令调度入口
* @param {命令} cmd
* @param {参数} params
*/
function handle(cmd, params) {
console.log('bridgeHandler处理 cmd=%s, params=%s', cmd, JSON.stringify(params));
// 调度方法命名
let fun = this[cmd];
if (!fun) {
throw new Error("cmd= " + cmd + " 没有定义实现");
}
let ret = fun(params)
log(ret)
return fun(params);
}
/**
* 处理逻辑例子: toast 提示
*/
function toastAction(params) {
toast(params.msg);
return {msg: 'toast提示成功'};
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jin-xuening/autojs-webView.git
git@gitee.com:jin-xuening/autojs-webView.git
jin-xuening
autojs-webView
autojs-webView
master

搜索帮助