google.script.run.withSuccessHandler don't return value

前端 未结 1 1901
梦如初夏
梦如初夏 2021-01-22 04:37

it is getting me crazy, the code was working yesterday, but not anymore. I tried to check all syntax again, but the issue still persists. this server-side request from google sh

相关标签:
1条回答
  • 2021-01-22 05:44

    I bumped into this issue some time ago and it also nearly drove me mad (oh, the joys of loosely-typed JS!). The problem is that you are trying to return an unacceptable type of data to client-side. Functions called via google.script.run have restrictions on what they can return (for example, you should avoid Date instances).

    Restricted types

    Currently, you can't return (take a look at the documentation for detailed explanation of restrictions):

    1. Date instances;
    2. Function;
    3. DOM elements (though form is permitted);

    Solution

    Changing ary[1]= new Date(r[0]); to ary[1] = r[0]; should do the trick, simply move Date parsing to the client.

    0 讨论(0)
提交回复
热议问题