Fix modals dependency cycle.

This commit forces the files that create modals to create their own
modal closing function instead of creating all of them in the modals
file. These functions are then passed to the modals.close object. This
is intended to remove modals.js's dependencies on these other files.
This commit is contained in:
wangjames
2017-03-18 14:47:13 -07:00
committed by showell
parent c999bdf823
commit 744f4aa663
7 changed files with 44 additions and 25 deletions

View File

@@ -376,6 +376,12 @@ exports.launch = function () {
};
$(function () {
function drafts_close_modal() {
hashchange.exit_modal();
}
modals.set_close_handler("drafts", drafts_close_modal);
window.addEventListener("beforeunload", function () {
exports.update_draft();
});