react-onesignal icon indicating copy to clipboard operation
react-onesignal copied to clipboard

[question]: Why is Init async, and shouldnt the window["onesignal"] queue get initialized earlier?

Open timbrownsf opened this issue 3 years ago • 3 comments

How can we help?

Init doesnt look like it needs to be async. It would be nice if it wasnt - most 3rd party trackers arent. Also, the window["OneSignal"] property seems to only be instantiated inside of the handleOnLoad method (which is called after the script is loaded). Shouldnt the property and queue be initialized immediately during init/module import vs when the script asynchronously returns?

Thank you!

timbrownsf avatar Aug 25 '22 19:08 timbrownsf

Howdy, Thanks for your patience.

I think you make an excellent point. Before making a decision, we would have to carefully consider the switch. That said, I can't think of a reason this cannot be done at the moment. However, note that we would not be able to remove this until a future major release.

If you could provide us with more info as to why this is important to you and how you are using the package, it may help guide us in our efforts.


Internal note: Related context: https://github.com/OneSignal/react-onesignal/pull/59

rgomezp avatar Sep 15 '22 23:09 rgomezp

This is important if someone tries to send data to OneSignal before the handleOnLoad method has been invoked

timbrownsf avatar Sep 15 '22 23:09 timbrownsf

@timbrownsf , I see. Are you trying to do something like set user data tags?

rgomezp avatar Sep 15 '22 23:09 rgomezp