Firebase:设置触发云功能,该功能仅在一定时间后才触发

时间:2019-10-02 13:42:49

标签: javascript firebase google-cloud-functions

我已经知道firebase允许您在创建,更新或删除文档时使用触发函数,并且还可以按计划运行函数。

对于我的特定问题,我需要在进行某些更改后的第二天准确运行一个函数。因此,触发函数将如下所示:

const setUpTheContdownTimer = functions.firestore
  .document('elements/{elementId}')
  .onUpdate(async (change, context) => {
    const data = change.after.data()

    if (data.setTimeTimer) {
      // TODO: set the timer for something that will update this element again in 24 hours
    }

  })

现在我的问题是这是否是正确的方法,以及如何设置将在24小时内触发的功能?

0 个答案:

没有答案