简体   繁体   English

将Google Apps脚本作为Web应用程序发布与将其作为服务发布

[英]Publish Google Apps Script as a Web App vs. publish it as a Service

In Google Apps Script Reference I found class Service and it has enable() method which "Enables the script to be published as a service". Google Apps脚本参考中,我找到了Service类,它具有enable()方法,该方法“启用将脚本作为服务发布”。 My question is: what's the benefit of publishing script as a service, how is it different from publishing it as a web app? 我的问题是:将脚本发布为服务有什么好处,与将其发布为Web应用程序有何不同? It's not clear from the reference. 根据参考资料尚不清楚。

I'm guessing a service is not supposed to have a UI in contrast to a web app, however I can create a web app without UI. 我猜测与Web应用程序相比,服务不应该具有UI,但是我可以创建没有UI的Web应用程序。

They are one and the same. 他们是一样的。 The old "Publish as service" terminology is replaced by "Publish as Web app". 旧的“发布为服务”术语被“发布为Web应用程序”代替。 In the context of Google Apps Script, a Web app is the same as a service. 在Google Apps脚本的上下文中,Web应用程序与服务相同。 A web app can have a UI (UIApp or HTMLService) or it may just serve text or JSON (ContentService). Web应用程序可以具有UI(UIApp或HTMLService),也可以仅提供文本或JSON(ContentService)。

Refer to the release notes for June 18, 2012 where it states "Publish > Publish as service is now Publish > Deploy as web app." 请参阅2012年6月18日的发行说明 ,其中指出“发布>发布为服务现在是发布>部署为Web应用程序”。

The Service class lets you do the publish actions programmatically and can be used for example, to provide your users with a good install experience. Service类使您可以以编程方式执行发布操作,例如,可用于为用户提供良好的安装体验。 Here's a link to the announcement with example code http://googleappsdeveloper.blogspot.com.au/2012/04/introducing-script-service.html 这是带有示例代码http://googleappsdeveloper.blogspot.com.au/2012/04/introducing-script-service.html的公告的链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM