【问题标题】:What is the Firebase RefBuilder.onOperation<T> method?什么是 Firebase RefBuilder.onOperation<T> 方法?
【发布时间】:2019-07-06 03:44:51
【问题描述】:

我想知道 functions.database.RefBuilder 的 onOperation 方法是做什么用的,因为我在documentation. 中找不到任何有关它的信息

【问题讨论】:

    标签: node.js firebase firebase-realtime-database google-cloud-functions firebase-admin


    【解决方案1】:

    firebase-functions repo 中的code of onOperations 来看,onOperation 似乎是所有其他人调用的常用方法。

    例如这里是onDelete的实现:

     onDelete(
        handler: (user: UserRecord, context: EventContext) => PromiseLike<any> | any
      ): CloudFunction<UserRecord> {
        return this.onOperation(handler, 'user.delete');
      }
    

    因此,这个(以及所有其他on... 方法)调用onOperation 进行实际工作,因为这些方法的很多实现是重叠的。

    我实际上不确定为什么onOperation 会出现在自动完成中,因为它被明确标记为private 方法:

    private onOperation(...
    

    【讨论】:

    • 感谢您的详细解释。奇怪的是它显示在自动完成中,这就是我感到困惑的原因。我正在使用 Visual Studio Code 1.29.1。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-07
    相关资源
    最近更新 更多