【问题标题】:can I have 2 functions in google.script.run?can I have 2 functions in google.script.run?
【发布时间】:2022-12-01 23:50:28
【问题描述】:

Can I have multiple apps script function in google.script.run like:

google.script.run.withSuccessHandler(function).scriptfunction1(variable).scriptfunction2(variable);

【问题讨论】:

  • Questions edits should not invalidate answers. If you need clarification or provide feedback regading an answer, post a comment in the corresponding answer. I you need to do a follow-up question, instead of editing an already answered question post a new question.

标签: google-apps-script web-applications


【解决方案1】:

No. The .scriptfunction1(variable) function cannot return a script runner. It can only return a value, an object or array that ultimately contains primitives, or undefined.

But you can do something like this (from the documentation):

const myRunner = google.script.run.withFailureHandler(onFailure);
const myRunner1 = myRunner.withSuccessHandler(onSuccess);
const myRunner2 = myRunner.withSuccessHandler(onDifferentSuccess);

myRunner1.doSomething();
myRunner1.doSomethingElse();
myRunner2.doSomething();

【讨论】:

    猜你喜欢
    • 2022-12-01
    • 2022-12-01
    • 2022-11-20
    • 2022-12-27
    • 2022-12-26
    • 2022-12-26
    • 2022-12-02
    • 2022-12-01
    • 2022-12-27
    相关资源
    最近更新 更多