Apps Script私有功能

Ben*_*oit 4 google-apps-script

在Google应用程序脚本文档中,有一个关于服务器端私有功能的页面.这应该说明没有私有函数,服务器代码可以从用户浏览器中看到.谁能解释一下如何在浏览器中看到这样的服务器端功能?谢谢

请参阅:https://developers.google.com/apps-script/guides/html/communication#private_functions

Hen*_*reu 5

所有人必须做的是检查google.script.run对象.例如:

function myFunction() {}

function anotherFunction() {}

function privateFunction_() {}

function doGet() {
  return HtmlService.createHtmlOutput(
    '<p id="output"></p>'+
    "<script>var s = ''; for( var prop in google.script.run ) s+=prop+'<br>';"+
    "document.getElementById('output').innerHTML = s;</script>"
  );
}
Run Code Online (Sandbox Code Playgroud)

以下是发布的示例:https: //script.google.com/macros/s/AKfycbzk0d03iB1O3vVYVD_U7eONM357iOPlAn7RFxAeZKx34q1Ones/exec

及其源代码. https://script.google.com/d/1WMY5jWblGl8U84WvVU_mZjHDg-6rGOoOPnKMF6m2bS_V-2g6IChBVDrg/edit