safwanrahman / django-webpush

Web Push Notification Package for Django
GNU General Public License v3.0
362 stars 103 forks source link

Custom callbacks on subscription #133

Open azmeuk opened 9 months ago

azmeuk commented 9 months ago

This would be very convenient to execute custom code when users subscribe or unsubscribe to notifications. I suggest implementing a callback mechanism, for instance by adding a callback parameter in to the subscribe and unsubscribe functions, and execute the callbacks in or instead of reg.pushManager.subscribe(options).then and subscription.unsubscribe().then for instance. What do you think?