我正在使用 Apps 脚本做很多场景的噩梦,但没有任何效果!我有一个GET
请求返回一组卡片的函数。现在,有时我需要再次刷新此卡以获取新内容。
function listTemplatesCards(){
var getAllTemplates = getTemplates();
var allTemplates = getAllTemplates.templates;
var theUserSlug = getAllTemplates.user_slug;
var templateCards = [];
//There are templates
if(allTemplates.length > 0){
allTemplates.forEach(function(template){
templateCards.push(templateCard(template, theUserSlug).build());
});
return templateCards;
}
}
该函数在 上调用onTriggerFunction
。现在,如果我移动到另一张卡并且我想再次回到根目录但以干净清晰的方式,我使用它但它不起作用:
//Move the user to the root card again
var refreshNav = CardService.newNavigation().popToRoot();
return CardService.newActionResponseBuilder().setStateChanged(true).setNavigation(refreshNav).build();
简单地说,我想要的是一旦用户单击Refresh
按钮,卡就会刷新/更新自身以再次拨打电话并获取新数据。