Skip to content

Commit ac71dc0

Browse files
authored
Merge branch 'master' into blocking-fn-enhancements
2 parents 4fc2803 + 6b02fd3 commit ac71dc0

File tree

51 files changed

+1607
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1607
-185
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ _Please avoid double posting across multiple channels!_
2323

2424
```js
2525
// functions/index.js
26-
const functions = require("firebase-functions");
26+
const { onValueCreated } = require("firebase-functions/database");
27+
const logger = require("firebase-functions/logger");
2728
const notifyUsers = require("./notify-users");
2829

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

0 commit comments

Comments
 (0)