From 0ef30c89562626b8f990d4e56e65abf96267a1da Mon Sep 17 00:00:00 2001
From: Syamjith <64262122+dev-skas@users.noreply.github.com>
Date: Mon, 24 Feb 2025 23:05:04 +0530
Subject: [PATCH 1/2] Update messaging.md

Fixed this.message$ placement
Added async before deleteToken()
---
 docs/messaging.md | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/docs/messaging.md b/docs/messaging.md
index 6a457527d..530a03826 100644
--- a/docs/messaging.md
+++ b/docs/messaging.md
@@ -83,6 +83,7 @@ import { Observable, tap } from "rxjs";
   providedIn: "root",
 })
 export class FcmService {
+  message$: Observable<any>;
   constructor(private msg: Messaging){
     Notification.requestPermission().then(
     (notificationPermissions: NotificationPermission) => {
@@ -105,19 +106,20 @@ export class FcmService {
           console.log('my fcm token', x);
           // This is a good place to then store it on your database for each user
         });
-	});  
-    }
+	   });  
+    
     this.message$ = new Observable((sub) => onMessage(this.msg, (msg) =>     
       sub.next(msg))).pipe(
 	    tap((msg) => {
 	      console.log("My Firebase Cloud Message", msg);
 	    })
     );
-    }
-  deleteToken(){
+  }
+ async deleteToken(){
     // We can also delete fcm tokens, make sure to also update this on your firestore db if you are storing them as well
     await deleteToken(this.msg);
   }
+}
 ```
 
 # Testing and Sending Notifications

From 1afd12cffdbefb926f5cf35f38299ed0ea98125a Mon Sep 17 00:00:00 2001
From: Syamjith <64262122+dev-skas@users.noreply.github.com>
Date: Tue, 25 Feb 2025 01:06:24 +0530
Subject: [PATCH 2/2] Update messaging.md

added styling to code
---
 docs/messaging.md | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/docs/messaging.md b/docs/messaging.md
index 530a03826..dd3d763a4 100644
--- a/docs/messaging.md
+++ b/docs/messaging.md
@@ -54,7 +54,7 @@ There are two parts to Firebase Messaging, a Service Worker and the DOM API. Ang
 
 It may be wise to use file replacements or environments here for different environments
 
-```
+```ts
 // This sample application is using 9.22, make sure you are importing the same version
 
 import { initializeApp } from "https://www.gstatic.com/firebasejs/9.22.0/firebase-app.js";
@@ -74,7 +74,7 @@ const messaging = getMessaging(firebaseApp);
 
 # Example messaging service
 
-```
+```ts
 import { Injectable } from "@angular/core";
 import { Messaging, getToken, onMessage, deleteToken } from "@angular/fire/messaging";
 import { Observable, tap } from "rxjs";
@@ -128,7 +128,7 @@ Firebase will allow you to send a test notification under Engage > Messaging > N
 
 Here is a barebones Node example:
 
-```
+```js
 export const sendTestMessage = onRequest(async (_, res) => {
   try {
     const message = {
@@ -149,7 +149,7 @@ export const sendTestMessage = onRequest(async (_, res) => {
 
 Here is a Node example that listens for a new comment on a collection, then sends a notification, and also adds it to a cache on Firebase so users can click through them.
 
-```
+```js
 exports.onPostReply =
   onDocumentCreated("comments/{commentId}", async (event) => {
     if (!event) throw new Error("No event found for document creation");
@@ -224,4 +224,5 @@ async function createNotificationAndCache(
     firestore.collection("notificationCache").add(notificationCacheValue));
 
   await Promise.all(promises);
-}  ```
+} 
+```