功能
功能 | 描述 |
---|---|
onDocumentCreated(文檔,處理程序) | 在 Firestore 中建立文件時觸發的事件處理程序。 |
onDocumentCreated(選擇,處理程序) | 在 Firestore 中建立文件時觸發的事件處理程序。 |
onDocumentDeleted(文檔,處理程序) | 在 Firestore 中刪除文件時觸發的事件處理程序。 |
onDocumentDeleted(選項,處理程序) | 在 Firestore 中刪除文件時觸發的事件處理程序。 |
onDocumentUpdated(文檔,處理程序) | 當 Firestore 中更新文件時觸發的事件處理程序。 |
onDocumentUpdated(選項,處理程序) | 當 Firestore 中更新文件時觸發的事件處理程序。 |
onDocumentWritten(文檔,處理程序) | 在 Firestore 中建立、更新或刪除文件時觸發的事件處理程序。 |
onDocumentWritten(選項,處理程序) | 在 Firestore 中建立、更新或刪除文件時觸發的事件處理程序。 |
課程
班級 | 描述 |
---|---|
改變 | 用於更改狀態的事件的 Cloud Functions 接口,例如即時資料庫或 Cloud Firestore onWrite 和onUpdate 事件。有關用於構造Change 物件的格式的更多信息,請參見下文。 |
介面
介面 | 描述 |
---|---|
文件選項 | DocumentOptions 使用提供的文件以及可選的資料庫和命名空間擴充 EventHandlerOptions。 |
Firestore事件 | 包含 DocumentSnapshot 或更改的 CloudEvent |
類型別名
類型別名 | 描述 |
---|---|
文件快照 | Firestore 文件快照 |
查詢文件快照 | Firestore 查詢文件快照 |
firestore.onDocumentCreated()
在 Firestore 中建立文件時觸發的事件處理程序。
簽名:
export declare function onDocumentCreated<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
參數
範圍 | 類型 | 描述 |
---|---|---|
文件 | 文件 | 要觸發的 Firestore 文件路徑。 |
處理程式 | (活動: FirestoreEvent <查詢文件快照|未定義, ParamsOf <文檔>>) => 任何 |承諾<任何> | 每次建立 Firestore 時都會執行的事件處理程序。 |
返回:
雲函數< Firestore事件<查詢文件快照|未定義, ParamsOf <文件>>>
firestore.onDocumentCreated()
在 Firestore 中建立文件時觸發的事件處理程序。
簽名:
export declare function onDocumentCreated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
參數
範圍 | 類型 | 描述 |
---|---|---|
選擇 | 文件選項<文件> | 可以在單一事件處理函數上設定的選項。 |
處理程式 | (活動: FirestoreEvent <查詢文件快照|未定義, ParamsOf <文檔>>) => 任何 |承諾<任何> | 每次建立 Firestore 時都會執行的事件處理程序。 |
返回:
雲函數< Firestore事件<查詢文件快照|未定義, ParamsOf <文件>>>
firestore.onDocumentDeleted()
在 Firestore 中刪除文件時觸發的事件處理程序。
簽名:
export declare function onDocumentDeleted<Document extends string>(document: Document, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
參數
範圍 | 類型 | 描述 |
---|---|---|
文件 | 文件 | 要觸發的 Firestore 文件路徑。 |
處理程式 | (活動: FirestoreEvent <查詢文件快照|未定義, ParamsOf <文檔>>) => 任何 |承諾<任何> | 每次發生 Firestore 刪除時都會執行的事件處理程序。 |
返回:
雲函數< Firestore事件<查詢文件快照|未定義, ParamsOf <文件>>>
firestore.onDocumentDeleted()
在 Firestore 中刪除文件時觸發的事件處理程序。
簽名:
export declare function onDocumentDeleted<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<QueryDocumentSnapshot | undefined, ParamsOf<Document>>>;
參數
範圍 | 類型 | 描述 |
---|---|---|
選擇 | 文件選項<文件> | 可以在單一事件處理函數上設定的選項。 |
處理程式 | (活動: FirestoreEvent <查詢文件快照|未定義, ParamsOf <文檔>>) => 任何 |承諾<任何> | 每次發生 Firestore 刪除時都會執行的事件處理程序。 |
返回:
雲函數< Firestore事件<查詢文件快照|未定義, ParamsOf <文件>>>
firestore.onDocumentUpdated()
當 Firestore 中更新文件時觸發的事件處理程序。
簽名:
export declare function onDocumentUpdated<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
參數
範圍 | 類型 | 描述 |
---|---|---|
文件 | 文件 | 要觸發的 Firestore 文件路徑。 |
處理程式 | (活動: FirestoreEvent <改變<查詢文件快照> |未定義, ParamsOf <文檔>>) => 任何 |承諾<任何> | 每次發生 Firestore 更新時執行的事件處理程序。 |
返回:
雲函數< Firestore事件<改變<查詢文件快照> |未定義, ParamsOf <文件>>>
firestore.onDocumentUpdated()
當 Firestore 中更新文件時觸發的事件處理程序。
簽名:
export declare function onDocumentUpdated<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<QueryDocumentSnapshot> | undefined, ParamsOf<Document>>>;
參數
範圍 | 類型 | 描述 |
---|---|---|
選擇 | 文件選項<文件> | 可以在單一事件處理函數上設定的選項。 |
處理程式 | (活動: FirestoreEvent <改變<查詢文件快照> |未定義, ParamsOf <文檔>>) => 任何 |承諾<任何> | 每次發生 Firestore 更新時執行的事件處理程序。 |
返回:
雲函數< Firestore事件<改變<查詢文件快照> |未定義, ParamsOf <文件>>>
firestore.onDocumentWritten()
在 Firestore 中建立、更新或刪除文件時觸發的事件處理程序。
簽名:
export declare function onDocumentWritten<Document extends string>(document: Document, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
參數
範圍 | 類型 | 描述 |
---|---|---|
文件 | 文件 | 要觸發的 Firestore 文件路徑。 |
處理程式 | (活動: FirestoreEvent <改變<文件快照> |未定義, ParamsOf <文檔>>) => 任何 |承諾<任何> | 每次發生 Firestore 建立、更新或刪除時都會執行的事件處理程序。 |
返回:
雲函數< Firestore事件<改變<文件快照> |未定義, ParamsOf <文件>>>
firestore.onDocumentWritten()
在 Firestore 中建立、更新或刪除文件時觸發的事件處理程序。
簽名:
export declare function onDocumentWritten<Document extends string>(opts: DocumentOptions<Document>, handler: (event: FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>) => any | Promise<any>): CloudFunction<FirestoreEvent<Change<DocumentSnapshot> | undefined, ParamsOf<Document>>>;
參數
範圍 | 類型 | 描述 |
---|---|---|
選擇 | 文件選項<文件> | 可以在單一事件處理函數上設定的選項。 |
處理程式 | (活動: FirestoreEvent <改變<文件快照> |未定義, ParamsOf <文檔>>) => 任何 |承諾<任何> | 每次發生 Firestore 建立、更新或刪除時都會執行的事件處理程序。 |
返回:
雲函數< Firestore事件<改變<文件快照> |未定義, ParamsOf <文件>>>
firestore.DocumentSnapshot
Firestore 文件快照
簽名:
export type DocumentSnapshot = firestore.DocumentSnapshot;
firestore.QueryDocumentSnapshot
Firestore 查詢文件快照
簽名:
export type QueryDocumentSnapshot = firestore.QueryDocumentSnapshot;