Cleanup event queues when browser windows reload.

(imported from commit ec06517ecc64af1724115bc94a0996a2822e2292)
This commit is contained in:
Tim Abbott 2013-11-20 13:42:37 -05:00
parent 630cfd72f1
commit 511856eba2
1 changed files with 14 additions and 0 deletions

View File

@ -1019,6 +1019,20 @@ function force_get_updates() {
get_updates_timeout = setTimeout(get_updates, 0);
}
function cleanup_event_queue() {
// Submit a request to the server to cleanup our event queue
$.ajax({
type: 'DELETE',
url: '/json/events',
data: {queue_id: get_updates_params.queue_id},
dataType: 'json'
});
}
window.addEventListener("beforeunload", function (event) {
cleanup_event_queue();
});
function process_result(messages, opts) {
$('#get_old_messages_error').hide();