且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我应该在哪里调用getUserProperties函数?

更新时间:2022-12-29 09:32:23

属性服务只能通过Google Apps脚本访问,所以必须在你的一个 * .gs 文件中调用它。要执行服务器端功能,您需要使用 google.script.run (还有指南可用)。

Properties Service can only be accessed through Google Apps Script, so it must be called in one of your *.gs files. To execute a server-side function, you need to use google.script.run (there's also a guide available).

例如,在你的 code.gs 文件中添加这个函数:

For example, in your code.gs file add this function:

function savePositions(propertyName, value) {
  PropertiesService.getUserProperties().setProperty(propertyName, value);
}

然后,在 index.html $中c $ c>文件修改 saveList() to:

Then, in your index.html file modify saveList() to:

function saveList() {
  google.script.run.savePositions("myProperty", JSON.stringify(positions));
}