NativeScript / firebase

Modular Firebase 🔥 implementation for NativeScript. Supports both iOS & Android platforms for all Firebase services.
https://docs.nativescript.org/plugins/firebase-core.html
Apache License 2.0
56 stars 50 forks source link

Expost remove listeners for firebase messaging #240

Open ubaidazad opened 9 months ago

ubaidazad commented 9 months ago

When listening to onMessage, onNotificationTap there is no way to remove listeners and is leading to memory leak

// on message
firebase()
    .messaging()
    .onMessage(async (remoteMessage) => {
      console.log({ remoteMessage });
    });

// on notification tap
    firebase()
      .messaging()
      .onNotificationTap((message) => {
        console.log({ message });
      });

there is no way to remove listeners as there is for firebase auth

firebase().auth().addAuthStateChangeListener
firebase().auth().removeAuthStateChangeListener