[英]Appscript addon triggers are set inside my addon project, instead of user's spreadsheet's appscript project
I am creating an appscript addon named Everyday Addon
which create trigger named Trigger1
which runs every day.我正在创建一个名为
Everyday Addon
的 appscript 插件,它创建名为Trigger1
的触发器,它每天运行。
Trigger1
can be set by Add Trigger
button in addon homepage. Trigger1
可以通过插件主页中的Add Trigger
按钮来设置。 Similarly it can be removed by Remove Trigger
button.同样,它可以通过
Remove Trigger
按钮删除。 Similarly remove button is also working, but working on my Addon Appscript project.同样,删除按钮也在工作,但在我的 Addon Appscript 项目上工作。
Testing:测试:
Test SS
.Test SS
的新电子表格。 It has my addon already installed.Add Trigger
button.Add Trigger
按钮。 Results: Trigger1
is created but it is created on my Everyday Addon
Appscript project.结果:
Trigger1
已创建,但它是在我的Everyday Addon
Appscript 项目中创建的。 It is not created on the new spreadsheet- Test SS
.它不是在新的电子表格
Test SS
上创建的。
What did I got wrong?我做错了什么? Should not the trigger sit on
Test SS
spreadsheet's project?触发器不应该放在
Test SS
电子表格的项目上吗? If 100's of user install my addon then 100 of Trigger will sit on my Addon project?如果 100 的用户安装我的插件,那么 100 的触发器将坐在我的插件项目中?
This is intended behaviour!这是预期的行为!
The trigger that you create programmatically will be attached to the add-on rather than the target Spreadsheet - this is because the function you intend to run on trigger is in the add-on project file, not the target Sheet's bound script.您以编程方式创建的触发器将附加到加载项而不是目标电子表格 - 这是因为您打算在触发器上运行的 function 位于加载项项目文件中,而不是目标工作表的绑定脚本中。
That being said - this is per-user behaviour.话虽如此 - 这是每个用户的行为。 You won't have hundreds of triggers all bound to your script project after publishing because each time a trigger is created by a user it will be tied to their account and not yours.
发布后,您不会将数百个触发器全部绑定到您的脚本项目,因为每次用户创建触发器时,它将绑定到他们的帐户,而不是您的帐户。
Remember: the Apps Script Quotas limit triggers to 20 per user per script , so each user can have up to 20 triggers installed via your add-on before they will not be able to install any more.请记住: Apps 脚本配额将触发器限制为每个用户每个脚本 20 个,因此每个用户最多可以通过您的插件安装 20 个触发器,然后他们将无法再安装。
Further reading: as per the documentation on testing editor add-ons :进一步阅读:根据测试编辑器插件的文档:
Installable triggers aren't supported when testing.
测试时不支持可安装触发器。 Functionality that depends on installable triggers are not testable.
依赖于可安装触发器的功能是不可测试的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.