Skip to content

Commit

Permalink
Add Callback on Window Hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus committed Jul 6, 2020
1 parent 08e8d56 commit 5add359
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ link will receive a `click` event.
Use `dataConfirmModal.confirm()` passing any of the supported options, and pass
an `onConfirm` and `onCancel` callbacks that'll be invoked when the user clicks
the confirm or the cancel buttons.
`onHide` callback will be invoked when the modal closes.

dataConfirmModal.confirm({
title: 'Are you sure?',
Expand All @@ -124,7 +125,8 @@ the confirm or the cancel buttons.
cancel: 'Not really',
zIindex: 10099,
onConfirm: function() { alert('confirmed') },
onCancel: function() { alert('cancelled') }
onCancel: function() { alert('cancelled') },
onHide: function() { alert('hidden') }
});

### Modal Options
Expand Down
5 changes: 5 additions & 0 deletions vendor/assets/javascripts/data-confirm-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@

modal.modal('hide');
});

modal.on('hidden.bs.modal', function () {
if (options.onHide && options.onHide.call)
options.onHide.call();
});
}
};

Expand Down

0 comments on commit 5add359

Please sign in to comment.