firestore namespace

Chức năng

Chức năng Sự miêu tả
onDocumentCreated(tài liệu, trình xử lý) Trình xử lý sự kiện kích hoạt khi tài liệu được tạo trong Firestore.
onDocumentCreated(opts, handler) Trình xử lý sự kiện kích hoạt khi tài liệu được tạo trong Firestore.
onDocumentDeleted(tài liệu, trình xử lý) Trình xử lý sự kiện kích hoạt khi tài liệu bị xóa trong Firestore.
onDocumentDeleted(opts, handler) Trình xử lý sự kiện kích hoạt khi tài liệu bị xóa trong Firestore.
onDocumentUpdated(tài liệu, trình xử lý) Trình xử lý sự kiện kích hoạt khi tài liệu được cập nhật trong Firestore.
onDocumentUpdated(opts, handler) Trình xử lý sự kiện kích hoạt khi tài liệu được cập nhật trong Firestore.
onDocumentWrite(tài liệu, trình xử lý) Trình xử lý sự kiện kích hoạt khi tài liệu được tạo, cập nhật hoặc xóa trong Firestore.
onDocumentWrite(opts, handler) Trình xử lý sự kiện kích hoạt khi tài liệu được tạo, cập nhật hoặc xóa trong Firestore.

Các lớp học

Lớp học Sự miêu tả
Thay đổi Giao diện Cloud Functions dành cho các sự kiện thay đổi trạng thái, chẳng hạn như Cơ sở dữ liệu thời gian thực hoặc các sự kiện onWriteonUpdate của Cloud Firestore. Để biết thêm thông tin về định dạng được sử dụng để xây dựng các đối tượng Change , hãy xem bên dưới.

Giao diện

Giao diện Sự miêu tả
Tùy chọn tài liệu DocumentOptions mở rộng EventHandlerOptions với tài liệu được cung cấp cũng như cơ sở dữ liệu và không gian tên tùy chọn.
FirestoreSự kiện CloudEvent chứa DocumentSnapshot hoặc Change

Nhập bí danh

Nhập bí danh Sự miêu tả
Tài LiệuẢnh Chụp Nhanh Ảnh chụp nhanh tài liệu Firestore
Ảnh chụp nhanh tài liệu truy vấn Ảnh chụp tài liệu truy vấn của Firestore

firestore.onDocumentCreated()

Trình xử lý sự kiện kích hoạt khi tài liệu được tạo trong Firestore.

Chữ ký:

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>>>;

Thông số

Tham số Kiểu Sự miêu tả
tài liệu Tài liệu Đường dẫn tài liệu Firestore để kích hoạt.
người xử lý (sự kiện: Sự kiện Firestore < Ảnh chụp tài liệu truy vấn | không xác định, ParamsOf <Tài liệu>>) => bất kỳ | Hứa<bất kỳ> Trình xử lý sự kiện được chạy mỗi khi quá trình tạo Firestore diễn ra.

Trả về:

Chức năng đám mây < Sự kiện Firestore < Ảnh chụp tài liệu truy vấn | không xác định, ParamsOf <Tài liệu>>>

firestore.onDocumentCreated()

Trình xử lý sự kiện kích hoạt khi tài liệu được tạo trong Firestore.

Chữ ký:

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>>>;

Thông số

Tham số Kiểu Sự miêu tả
chọn Tùy chọn tài liệu <Tài liệu> Các tùy chọn có thể được đặt trên một chức năng xử lý sự kiện riêng lẻ.
người xử lý (sự kiện: Sự kiện Firestore < Ảnh chụp tài liệu truy vấn | không xác định, ParamsOf <Tài liệu>>) => bất kỳ | Hứa<bất kỳ> Trình xử lý sự kiện được chạy mỗi khi quá trình tạo Firestore diễn ra.

Trả về:

Chức năng đám mây < Sự kiện Firestore < Ảnh chụp tài liệu truy vấn | không xác định, ParamsOf <Tài liệu>>>

firestore.onDocumentDeleted()

Trình xử lý sự kiện kích hoạt khi tài liệu bị xóa trong Firestore.

Chữ ký:

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>>>;

Thông số

Tham số Kiểu Sự miêu tả
tài liệu Tài liệu Đường dẫn tài liệu Firestore để kích hoạt.
người xử lý (sự kiện: Sự kiện Firestore < Ảnh chụp tài liệu truy vấn | không xác định, ParamsOf <Tài liệu>>) => bất kỳ | Hứa<bất kỳ> Trình xử lý sự kiện được chạy mỗi khi xảy ra quá trình xóa Firestore.

Trả về:

Chức năng đám mây < Sự kiện Firestore < Ảnh chụp tài liệu truy vấn | không xác định, ParamsOf <Tài liệu>>>

firestore.onDocumentDeleted()

Trình xử lý sự kiện kích hoạt khi tài liệu bị xóa trong Firestore.

Chữ ký:

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>>>;

Thông số

Tham số Kiểu Sự miêu tả
chọn Tùy chọn tài liệu <Tài liệu> Các tùy chọn có thể được đặt trên một chức năng xử lý sự kiện riêng lẻ.
người xử lý (sự kiện: Sự kiện Firestore < Ảnh chụp tài liệu truy vấn | không xác định, ParamsOf <Tài liệu>>) => bất kỳ | Hứa<bất kỳ> Trình xử lý sự kiện được chạy mỗi khi xảy ra quá trình xóa Firestore.

Trả về:

Chức năng đám mây < Sự kiện Firestore < Ảnh chụp tài liệu truy vấn | không xác định, ParamsOf <Tài liệu>>>

firestore.onDocumentUpdated()

Trình xử lý sự kiện kích hoạt khi tài liệu được cập nhật trong Firestore.

Chữ ký:

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>>>;

Thông số

Tham số Kiểu Sự miêu tả
tài liệu Tài liệu Đường dẫn tài liệu Firestore để kích hoạt.
người xử lý (sự kiện: Sự kiện Firestore < Thay đổi < Ảnh chụp nhanh tài liệu truy vấn > | không xác định, ParamsOf <Tài liệu>>) => bất kỳ | Hứa<bất kỳ> Trình xử lý sự kiện được chạy mỗi khi xảy ra cập nhật Firestore.

Trả về:

Chức năng đám mây < Sự kiện Firestore < Thay đổi < Ảnh chụp nhanh tài liệu truy vấn > | không xác định, ParamsOf <Tài liệu>>>

firestore.onDocumentUpdated()

Trình xử lý sự kiện kích hoạt khi tài liệu được cập nhật trong Firestore.

Chữ ký:

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>>>;

Thông số

Tham số Kiểu Sự miêu tả
chọn Tùy chọn tài liệu <Tài liệu> Các tùy chọn có thể được đặt trên một chức năng xử lý sự kiện riêng lẻ.
người xử lý (sự kiện: Sự kiện Firestore < Thay đổi < Ảnh chụp nhanh tài liệu truy vấn > | không xác định, ParamsOf <Tài liệu>>) => bất kỳ | Hứa<bất kỳ> Trình xử lý sự kiện được chạy mỗi khi xảy ra cập nhật Firestore.

Trả về:

Chức năng đám mây < Sự kiện Firestore < Thay đổi < Ảnh chụp nhanh tài liệu truy vấn > | không xác định, ParamsOf <Tài liệu>>>

firestore.onDocumentWritten()

Trình xử lý sự kiện kích hoạt khi tài liệu được tạo, cập nhật hoặc xóa trong Firestore.

Chữ ký:

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>>>;

Thông số

Tham số Kiểu Sự miêu tả
tài liệu Tài liệu Đường dẫn tài liệu Firestore để kích hoạt.
người xử lý (sự kiện: Sự kiện Firestore < Thay đổi < Ảnh chụp tài liệu > | không xác định, ParamsOf <Tài liệu>>) => bất kỳ | Hứa<bất kỳ> Trình xử lý sự kiện được chạy mỗi khi xảy ra quá trình tạo, cập nhật hoặc xóa Firestore.

Trả về:

Chức năng đám mây < Sự kiện Firestore < Thay đổi < Ảnh chụp tài liệu > | không xác định, ParamsOf <Tài liệu>>>

firestore.onDocumentWritten()

Trình xử lý sự kiện kích hoạt khi tài liệu được tạo, cập nhật hoặc xóa trong Firestore.

Chữ ký:

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>>>;

Thông số

Tham số Kiểu Sự miêu tả
chọn Tùy chọn tài liệu <Tài liệu> Các tùy chọn có thể được đặt trên một chức năng xử lý sự kiện riêng lẻ.
người xử lý (sự kiện: Sự kiện Firestore < Thay đổi < Ảnh chụp tài liệu > | không xác định, ParamsOf <Tài liệu>>) => bất kỳ | Hứa<bất kỳ> Trình xử lý sự kiện được chạy mỗi khi xảy ra quá trình tạo, cập nhật hoặc xóa Firestore.

Trả về:

Chức năng đám mây < Sự kiện Firestore < Thay đổi < Ảnh chụp tài liệu > | không xác định, ParamsOf <Tài liệu>>>

firestore.DocumentSnapshot

Ảnh chụp nhanh tài liệu Firestore

Chữ ký:

export type DocumentSnapshot = firestore.DocumentSnapshot;

firestore.QueryDocumentSnapshot

Ảnh chụp tài liệu truy vấn của Firestore

Chữ ký:

export type QueryDocumentSnapshot = firestore.QueryDocumentSnapshot;