react-onesignal
react-onesignal copied to clipboard
Reject promise returned from init if script loading fails
Firstly, semantically doesn't make much sense to resolve a promise which obviously failed.
Apart from that, we're handling the logic for when the user has AdBlock turned on, where we show a popup asking the user to disable the AdBlock in able to receive push notifications (which I suspect most developers would do), rejecting the promise returned from init removes the need for workarounds while still keeping the functionality untouched for other cases.
This would be a breaking change so we would need to include this in a potential major release.
Furthermore, we don't want to raise an error for simply having ad block turned on.
rejecting the promise returned from init removes the need for workarounds while still keeping the functionality untouched for other cases.
can you please elaborate a bit more on this point? what workaround are you referencing here? and what other cases?
Would accepting a onError callback be a better option? Shouldn't be a breaking change then as the functionality would remain the same as now.
Well, in the current state, library doesn't let you handle the case when AdBlock is on and blocking One Signal from loading at all. We've used some workarounds like pinging OneSignal URL and checking if the request goes through but this is heaps cleaner.
I'd also expect basically any production implementation to want to handle blocked notifications, so IMHO is an important feature.