Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.3 Release #59

Merged
merged 1 commit into from
Feb 8, 2022
Merged

2.0.3 Release #59

merged 1 commit into from
Feb 8, 2022

Conversation

rgomezp
Copy link
Contributor

@rgomezp rgomezp commented Feb 8, 2022

Switch from a timeout strategy to script#onload and script#onerror so
that calls to #init will always resolve. This is important for consumers
of the react-onesignal package who want to call multiple functions
synchronously, for example:

const doThingsInOrder = async () => {
  await OneSignal.init({ ... });
  await OneSignal.showSlidedownPrompt();
};

Without this change, those calls will hang indefinitely if adblock
prevents executing the web SDK from the cdn.onesignal.com domain.

An additional flag, isOneSignalScriptFailed is kept around to resolve
OneSignal SDK methods in the event of a CDN load failure. Since
resolutions in the queue are only called on #init, if SDK methods are
called after #init has already failed they will never resolve.


Also includes other minor miscellaneous nits and improvements.

@rgomezp rgomezp requested a review from mgmarlow February 8, 2022 01:48
@rgomezp rgomezp changed the title 2.0.3 Release Commit 2.0.3 Release Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants