Jelajahi Sumber

Updated README, note on Event [un]subscribing (#1475)

Added some short note on what to consider when unsubscribing from events.
Martin Kausche 8 tahun lalu
induk
melakukan
4e7a2ef478
1 mengubah file dengan 3 tambahan dan 0 penghapusan
  1. 3 0
      README.md

+ 3 - 0
README.md

@@ -432,6 +432,9 @@ To unsubscribe from events:
 cordova.plugins.notification.local.un(event, callback, scope);
 ```
 
+__Note:__ You have to provide the exact same callback to `cordova.plugins.notification.local.un` as you provided to `cordova.plugins.notification.local.on` to make unsubscribing work.  
+Hence you should define your callback as a separate function, not inline. If you want to use `this` inside of your callback, you also have to provide `this` as `scope` to `cordova.plugins.notification.local.on`.
+
 ### Custom
 
 The plugin also fires events specified by actions.