Skip to content

Commit

Permalink
Merge pull request #1777 from helen-ndip/dismiss-notifications
Browse files Browse the repository at this point in the history
close notifications after a set timeut of 6s or when user navigates f…
  • Loading branch information
AmTryingMyBest authored Apr 25, 2022
2 parents 795bdac + 38be241 commit 9480e8e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions legacy/app/common/notifications/slider.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ function SliderService($rootScope, $q, $templateRequest) {
deferredOpen.promise.then(function () {
$rootScope.$emit('slider:open', template, icon, iconClass, scope, closeOnTimeout, showCloseButton, closeOnNavigate, loading, type);
});

closeOnNavigation();
}

function close() {
Expand All @@ -40,4 +42,12 @@ function SliderService($rootScope, $q, $templateRequest) {
}
deferredClose.resolve();
}

function closeOnNavigation() {
let sliderClose = () => {
close();
window.removeEventListener('popstate', sliderClose, false);
}
window.addEventListener('popstate', sliderClose, false);
}
}

0 comments on commit 9480e8e

Please sign in to comment.