问题描述
这是我正在运行的代码
document.addEventListener('DOMContentLoaded',function() {
google.script.run.withSuccessHandler(populateSearchDropDown).searchByVehicleNum();
});
现在我的问题是, 我可以在 withSuccessHandler 内部传递 2 个回调函数吗?
类似的东西
google.script.run.withSuccessHandler(function1,function2).scriptFunc();
顺便说一句,我试过了,但它不起作用
解决方法
既然如此,下面的修改如何?
来自:
google.script.run.withSuccessHandler(function1,function2).scriptFunc();
致:
google.script.run.withSuccessHandler(sample).scriptFunc();
function sample(e) {
function1(e);
function2(e);
}
或
google.script.run.withSuccessHandler(e => {function1(e),function2(e)}).scriptFunc();