onDocumentWritten method

JSFunction onDocumentWritten(
  1. JSAny documentOrOpts,
  2. JSFunction handler
)

Event handler that triggers when a document is created, updated, or deleted in Firestore.

@param documentOrOpts - Options or a string document path. @param handler - Event handler which is run every time a Firestore create, update, or delete occurs.

Implementation

external JSFunction onDocumentWritten(
  JSAny documentOrOpts,
  // (FirestoreEvent<DocumentSnapshot> event) => FutureOr<void>
  JSFunction handler,
);