微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我可以在 withSuccessHandler 内部传递多个回调函数吗? 来自:致:参考:

如何解决我可以在 withSuccessHandler 内部传递多个回调函数吗? 来自:致:参考:

这是我正在运行的代码

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();

参考:

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。