Skip to content

Commit

Permalink
Cleanup interval for mappable video before navigation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ethib137 committed Apr 6, 2021
1 parent 5051243 commit 3aa79a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ const mappableVideo = fragmentElement.querySelector('.mappable-video');

let intervalID;

const resetInterval = () => {
clearInterval(intervalID);

intervalID = null;
}

const onPlay = (getCurrentTime) => {
mappableVideo.classList.add('playing');

if (intervalID) {
clearInterval(intervalID);
resetInterval();
}

intervalID = setInterval(() => {
Expand All @@ -32,11 +39,13 @@ const onPlay = (getCurrentTime) => {
const onPause = () => {
mappableVideo.classList.remove('playing');

clearInterval(intervalID);

intervalID = null;
resetInterval();
}

Liferay.once('beforeNavigate', function() {
resetInterval();
});

const mappableVideoUrlNode = fragmentElement.querySelector('.mappable-url');

if (isEditMode && mappableVideoUrlNode) {
Expand Down
6 changes: 3 additions & 3 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ hub release create \
--attach modules/header-components-fragment-collection-contributor/build/libs/com.liferay.fragment.collection.contributor.header.components-1.0.0.jar \
--attach modules/integrations-fragment-collection-contributor/build/libs/com.liferay.fragment.collection.contributor.integrations-1.0.0.jar \
--attach modules/utilities-fragment-collection-contributor/build/libs/com.liferay.fragment.collection.contributor.utilities-1.0.0.jar \
--message 'v0.0.7' \
--message 'Fix mappable video when using a non mapped video.' \
'v0.0.7'
--message 'v0.0.8' \
--message 'Cleanup interval for mappable video before navigation.' \
'v0.0.8'

0 comments on commit 3aa79a1

Please sign in to comment.