OOP design, fixed events, no longer need to run startBackground(), openLoginPage back link customization, dates are now strings #295
+449
−335
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed the events weren't working properly, so decided to have a look myself and ended up tweaking some other things.
Ended up with the following changes:
startBackground();this code runs automatically when ExtPay(...) is called in the background process.openLoginPagenow accepts abackstring parameter, that allows the user to determine the location of the "back to ..." link on the login page. The value defaults to "choose-plan" to ensure backwards compatibility, but "trial" also works and hopefully in the future you can add support for null to remove it or "plan/x" to go to specific plan immediately.POTENTIALLY BREAKING:
browser.storage.setdoesn't store Dates properly when they're a part of an object (saves as{}instead of as an ISO string) and because communication of Dates between contexts serializes them to string anyway. This makes communicating events between contexts more straightforward and ensures the caller always knows what they get even if ExtPay does some messaging between contexts.