【问题标题】:Can I pass multiple callback function inside withSuccessHandler?我可以在 withSuccessHandler 内部传递多个回调函数吗?
【发布时间】:2021-06-29 23:43:33
【问题描述】:

这是我正在运行的代码

document.addEventListener('DOMContentLoaded', function() {
google.script.run.withSuccessHandler(populateSearchDropDown).searchByVehicleNum();
});

现在我的问题是, 我可以在 withSuccessHandler 内部传递 2 个回调函数吗?

类似的东西

google.script.run.withSuccessHandler(function1,function2).scriptFunc();

顺便说一句,我试过了,但它不起作用

【问题讨论】:

    标签: google-apps-script callback asynccallback multiple-arguments


    【解决方案1】:

    那么,下面的修改呢?

    发件人:

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

    参考:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-25
      • 2021-09-22
      • 2014-07-27
      相关资源
      最近更新 更多