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.
This implementation is similar to cordova-plugin-inappbrowser with the notable exception that
InAppBrowser
instances are created for each call to open a URL and any events are scoped to that particular instance. You don't need to remove events because they are not triggered the next time the browser is opened. In contrast, SafariViewController is a singleton and therefore the events may continue to fire for subsequent browser instances if not cleaned up. A particularly bad but not unlikely implementation would be to add an exit listener every time the browser is opened and never remove the listeners.Since there is only one event, currently it is easy to clean up the listener when it is called as shown in the demo. While the delegate does not allow nearly as much insight into the user's activity as in
UIWebView
, it is still possible that other events would be added (perhaps related to sharing) in which case a design closer to InAppBrowser may be an improvement.