Skip to content

Commit

Permalink
Merge branch 'master' into blocking-fn-enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
blidd-google authored Sep 19, 2024
2 parents 4fc2803 + 6b02fd3 commit ac71dc0
Show file tree
Hide file tree
Showing 51 changed files with 1,607 additions and 185 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ _Please avoid double posting across multiple channels!_

```js
// functions/index.js
const functions = require("firebase-functions");
const { onValueCreated } = require("firebase-functions/database");
const logger = require("firebase-functions/logger");
const notifyUsers = require("./notify-users");

exports.newPost = functions.database.ref("/posts/{postId}").onCreate((snapshot, context) => {
functions.logger.info("Received new post with ID:", context.params.postId);
return notifyUsers(snapshot.val());
exports.newPost = onValueCreated({ ref: "/posts/{postId}" }, (event) => {
logger.info("Received new post with ID:", event.params.postId);
return notifyUsers(event.data.val());
});
```

Expand Down
Loading

0 comments on commit ac71dc0

Please sign in to comment.