Closing loose components on navigation
This commit is contained in:
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;
|
||||
};
|
||||
Reference in new issue
Block a user