OneSignal / OneSignal-Website-SDK

OneSignal is a push notification service for web and mobile apps. This SDK makes it easy to integrate your website with OneSignal Push Notifications. https://onesignal.com
Other
389 stars 115 forks source link

[Question]: Any way to get feedback when the shim fails to load onesignal? #1197

Open ggrochow-dh opened 1 month ago

ggrochow-dh commented 1 month ago

How can we help?

How do I know in my website code if onesignal will never actually load and be initialized?

In certain environments im running into this case https://github.com/OneSignal/OneSignal-Website-SDK/blob/5868c0408c158c192e9e61420c71277d755105e2/src/page/utils/OneSignalShimLoader.ts#L65-L73

I don't see any way to tell if this happens other than a console.log being output, in these cases my init function just sits in the OneSignalDeferred array forever.

How can I detect when this happens in code so I can instruct the user this page will never work unless they take some action to fix it.

I can get onError callbacks to track when the script itself fails to load, but in these cases your script loads, then proceeds to do nothing.