Fix: Add pagehide event (Fixes #314) #315
Merged
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.
Fixes #314
Fix
Added the pagehide event next to the unload event with the same behaviour so that end-users won't notice when Google Chrome stops supporting unload. This is the same fix as was applied in the latest version of Spoor https://github.com/adaptlearning/adapt-contrib-spoor/pull/298/files.
Testing
To test this I tried removing the unload events entirely and switching to pagehide events. I created and published a course and I was able to see that my progress was saved if I closed the window part-way through.
Note
I'm not sure if there is a process for updating an older version of a plugin like this. I created a release-3.3 branch from the v3.3.2 tag. I have made a pull request to add this fix to the release-3.3 branch and I propose we tag v3.3.3 from the release-3.3 branch. I'm open to other suggestions if this isn't the way this is normally done in Adapt.