Closing loose components on navigation

This commit is contained in:
Bruno Alves de Faria committed 2017-11-23 18:40:58 -02:00
1 parent a6fc444209
commit a9698e6ad2
3 files changed
+35 -4

No files matched your search

@@ -28,6 +28,16 @@ OHIF.ui.showDropdown = (items=[], options={}) => {
const parentElement = options.parentElement || document.body;
view = Blaze.renderWithData(Template.dropdownForm, templateData, parentElement);
// Create a handler to dismiss the dropdown on navigation
const $body = $(document.body);
const navigationHandler = () => {
promiseReject();
$body.off('ohif.navigated', navigationHandler);
};
// Dismiss the dropdown if navigation occurs
$body.on('ohif.navigated', navigationHandler);
// Return the promise to allow callbacks stacking from outside
return promise;
};